home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / MacPerl 5.0.3 / MacPerl Source ƒ / Perl5 / ext / POSIX / POSIX.xs < prev    next >
Encoding:
Text File  |  1995-08-04  |  52.3 KB  |  3,069 lines  |  [TEXT/MPS ]

  1. #include "EXTERN.h"
  2. #include "perl.h"
  3. #include "XSUB.h"
  4. #include <ctype.h>
  5. #ifdef I_DIRENT    /* XXX maybe better to just rely on perl.h? */
  6. #include <dirent.h>
  7. #endif
  8. #include <errno.h>
  9. #include <fcntl.h>
  10. #ifdef I_FLOAT
  11. #include <float.h>
  12. #endif
  13. #ifndef macintosh
  14. #include <grp.h>
  15. #endif
  16. #ifdef I_LIMITS
  17. #include <limits.h>
  18. #endif
  19. #include <locale.h>
  20. #include <math.h>
  21. #ifdef I_PWD
  22. #include <pwd.h>
  23. #endif
  24. #include <setjmp.h>
  25. #include <signal.h>
  26. #ifdef I_STDARG
  27. #include <stdarg.h>
  28. #endif
  29. #ifdef I_STDDEF
  30. #include <stddef.h>
  31. #endif
  32. /* XXX This comment is just to make I_TERMIO and I_SGTTY visible to 
  33.    metaconfig for future extension writers.  We don't use them in POSIX.
  34.    (This is really sneaky :-)  --AD
  35. */
  36. #if defined(I_TERMIOS)
  37. #include <termios.h>
  38. #endif
  39. #include <stdio.h>
  40. #ifdef I_STDLIB
  41. #include <stdlib.h>
  42. #endif
  43. #include <string.h>
  44. #include <sys/stat.h>
  45. #ifndef macintosh
  46. #include <sys/times.h>
  47. #endif
  48. #include <sys/types.h>
  49. #ifdef HAS_UNAME
  50. #include <sys/utsname.h>
  51. #endif
  52. #ifndef macintosh
  53. #include <sys/wait.h>
  54. #endif
  55. #include <time.h>
  56. #include <unistd.h>
  57. #ifdef I_UTIME
  58. #include <utime.h>
  59. #endif
  60.  
  61. typedef FILE * InputStream;
  62. typedef FILE * OutputStream;
  63. typedef int SysRet;
  64. typedef long SysRetLong;
  65. #ifdef macintosh
  66. #define sigset_t int
  67. #define sigaction(x) not_here("sigaction")
  68. #define sigpending(x) not_here("sigpending")
  69. #define sigprocmask(x) not_here("sigprocmask")
  70. #define sigsuspend(x) not_here("sigsuspend")
  71. #define sigemptyset(x) not_here("sigemptyset")
  72. #define sigaddset(x,y) not_here("sigaddset")
  73. #define sigdelset(x,y) not_here("sigdelset")
  74. #define sigfillset(x) not_here("sigfillset")
  75. #define sigismember(x,y) not_here("sigismember")
  76. #define pipe(x) not_here("pipe")
  77. #define setgid(x) not_here("setgid")
  78. #define setuid(x) not_here("setuid")
  79. #define mknod(x,y,z) not_here("mknod")
  80. #define tzset() not_here("tzset")
  81. #define ttyname(x) (not_here("ttyname"), (char *) 0)
  82. #define open(name,flags,mode) (open)(name,flags)
  83. #endif
  84. typedef sigset_t* POSIX__SigSet;
  85. typedef HV* POSIX__SigAction;
  86. #ifdef I_TERMIOS
  87. typedef struct termios* POSIX__Termios;
  88. #else /* Define termios types to int, and call not_here for the functions.*/
  89. #define POSIX__Termios int
  90. #define speed_t int
  91. #define tcflag_t int
  92. #define cc_t int
  93. #define cfgetispeed(x) not_here("cfgetispeed")
  94. #define cfgetospeed(x) not_here("cfgetospeed")
  95. #define tcdrain(x) not_here("tcdrain")
  96. #define tcflush(x,y) not_here("tcflush")
  97. #define tcsendbreak(x,y) not_here("tcsendbreak")
  98. #define cfsetispeed(x,y) not_here("cfsetispeed")
  99. #define cfsetospeed(x,y) not_here("cfsetospeed")
  100. #define ctermid(x) (char *) not_here("ctermid")
  101. #define tcflow(x,y) not_here("tcflow")
  102. #define tcgetattr(x,y) not_here("tcgetattr")
  103. #define tcsetattr(x,y,z) not_here("tcsetattr")
  104. #endif
  105.  
  106. /* Possibly needed prototypes */
  107. char *cuserid _((char *));
  108.  
  109. #ifndef HAS_CUSERID
  110. #define cuserid(a) (char *) not_here("cuserid")
  111. #endif
  112. #ifndef HAS_DIFFTIME
  113. #ifndef difftime
  114. #define difftime(a,b) not_here("difftime")
  115. #endif
  116. #endif
  117. #ifndef HAS_FPATHCONF
  118. #define fpathconf(f,n)     (SysRetLong) not_here("fpathconf")
  119. #endif
  120. #ifndef HAS_MKTIME
  121. #define mktime(a) not_here("mktime")
  122. #endif
  123. #ifndef HAS_NICE
  124. #define nice(a) not_here("nice")
  125. #endif
  126. #ifndef HAS_PATHCONF
  127. #define pathconf(f,n)     (SysRetLong) not_here("pathconf")
  128. #endif
  129. #ifndef HAS_SYSCONF
  130. #define sysconf(n)     (SysRetLong) not_here("sysconf")
  131. #endif
  132. #ifndef HAS_READLINK
  133. #define readlink(a,b,c) not_here("readlink")
  134. #endif
  135. #ifndef HAS_SETPGID
  136. #define setpgid(a,b) not_here("setpgid")
  137. #endif
  138. #ifndef HAS_SETSID
  139. #define setsid() not_here("setsid")
  140. #endif
  141. #ifndef HAS_STRCOLL
  142. #define strcoll(s1,s2) not_here("strcoll")
  143. #endif
  144. #ifndef HAS_STRXFRM
  145. #define strxfrm(s1,s2,n) not_here("strxfrm")
  146. #endif
  147. #ifndef HAS_TCGETPGRP
  148. #define tcgetpgrp(a) not_here("tcgetpgrp")
  149. #endif
  150. #ifndef HAS_TCSETPGRP
  151. #define tcsetpgrp(a,b) not_here("tcsetpgrp")
  152. #endif
  153. #ifndef HAS_TIMES
  154. #define times(a) not_here("times")
  155. #endif
  156. #ifndef HAS_UNAME
  157. #define uname(a) not_here("uname")
  158. #endif
  159. #ifndef HAS_WAITPID
  160. #define waitpid(a,b,c) not_here("waitpid")
  161. #endif
  162.  
  163. #ifndef HAS_FGETPOS
  164. #define fgetpos(a,b) not_here("fgetpos")
  165. #endif
  166. #ifndef HAS_FSETPOS
  167. #define fsetpos(a,b) not_here("fsetpos")
  168. #endif
  169.  
  170. #ifndef HAS_MBLEN
  171. #ifndef mblen
  172. #define mblen(a,b) not_here("mblen")
  173. #endif
  174. #endif
  175. #ifndef HAS_MBSTOWCS
  176. #define mbstowcs(s, pwcs, n) not_here("mbstowcs")
  177. #endif
  178. #ifndef HAS_MBTOWC
  179. #define mbtowc(pwc, s, n) not_here("mbtowc")
  180. #endif
  181. #ifndef HAS_WCSTOMBS
  182. #define wcstombs(s, pwcs, n) not_here("wcstombs")
  183. #endif
  184. #ifndef HAS_WCTOMB
  185. #define wctomb(s, wchar) not_here("wcstombs")
  186. #endif
  187. #if !defined(HAS_MBLEN) && !defined(HAS_MBSTOWCS) && !defined(HAS_MBTOWC) && !defined(HAS_WCSTOMBS) && !defined(HAS_WCTOMB)
  188. /* If we don't have these functions, then we wouldn't have gotten a typedef
  189.    for wchar_t, the wide character type.  Defining wchar_t allows the
  190.    functions referencing it to compile.  Its actual type is then meaningless,
  191.    since without the above functions, all sections using it end up calling
  192.    not_here() and croak.  --Kaveh Ghazi (ghazi@noc.rutgers.edu) 9/18/94. */
  193. #ifndef wchar_t
  194. #define wchar_t char
  195. #endif
  196. #endif
  197.  
  198. #ifndef HAS_LOCALECONV
  199. #define localeconv() not_here("localeconv")
  200. #endif
  201.  
  202. #ifdef HAS_TZNAME
  203. extern char *tzname[];
  204. #else
  205. char *tzname[] = { "" , "" };
  206. #endif
  207.  
  208. #ifndef HAS_LONG_DOUBLE /* XXX What to do about long doubles? */
  209. #ifdef LDBL_MAX
  210. #undef LDBL_MAX
  211. #endif
  212. #ifdef LDBL_MIN
  213. #undef LDBL_MIN
  214. #endif
  215. #ifdef LDBL_EPSILON
  216. #undef LDBL_EPSILON
  217. #endif
  218. #endif
  219.  
  220. static int
  221. not_here(s)
  222. char *s;
  223. {
  224.     croak("POSIX::%s not implemented on this architecture", s);
  225.     return -1;
  226. }
  227.  
  228. static double
  229. constant(name, arg)
  230. char *name;
  231. int arg;
  232. {
  233.     errno = 0;
  234.     switch (*name) {
  235.     case 'A':
  236.     if (strEQ(name, "ARG_MAX"))
  237. #ifdef ARG_MAX
  238.         return ARG_MAX;
  239. #else
  240.         goto not_there;
  241. #endif
  242.     break;
  243.     case 'B':
  244.     if (strEQ(name, "BUFSIZ"))
  245. #ifdef BUFSIZ
  246.         return BUFSIZ;
  247. #else
  248.         goto not_there;
  249. #endif
  250.     if (strEQ(name, "BRKINT"))
  251. #ifdef BRKINT
  252.         return BRKINT;
  253. #else
  254.         goto not_there;
  255. #endif
  256.     if (strEQ(name, "B9600"))
  257. #ifdef B9600
  258.         return B9600;
  259. #else
  260.         goto not_there;
  261. #endif
  262.     if (strEQ(name, "B19200"))
  263. #ifdef B19200
  264.         return B19200;
  265. #else
  266.         goto not_there;
  267. #endif
  268.     if (strEQ(name, "B38400"))
  269. #ifdef B38400
  270.         return B38400;
  271. #else
  272.         goto not_there;
  273. #endif
  274.     if (strEQ(name, "B0"))
  275. #ifdef B0
  276.         return B0;
  277. #else
  278.         goto not_there;
  279. #endif
  280.     if (strEQ(name, "B110"))
  281. #ifdef B110
  282.         return B110;
  283. #else
  284.         goto not_there;
  285. #endif
  286.     if (strEQ(name, "B1200"))
  287. #ifdef B1200
  288.         return B1200;
  289. #else
  290.         goto not_there;
  291. #endif
  292.     if (strEQ(name, "B134"))
  293. #ifdef B134
  294.         return B134;
  295. #else
  296.         goto not_there;
  297. #endif
  298.     if (strEQ(name, "B150"))
  299. #ifdef B150
  300.         return B150;
  301. #else
  302.         goto not_there;
  303. #endif
  304.     if (strEQ(name, "B1800"))
  305. #ifdef B1800
  306.         return B1800;
  307. #else
  308.         goto not_there;
  309. #endif
  310.     if (strEQ(name, "B200"))
  311. #ifdef B200
  312.         return B200;
  313. #else
  314.         goto not_there;
  315. #endif
  316.     if (strEQ(name, "B2400"))
  317. #ifdef B2400
  318.         return B2400;
  319. #else
  320.         goto not_there;
  321. #endif
  322.     if (strEQ(name, "B300"))
  323. #ifdef B300
  324.         return B300;
  325. #else
  326.         goto not_there;
  327. #endif
  328.     if (strEQ(name, "B4800"))
  329. #ifdef B4800
  330.         return B4800;
  331. #else
  332.         goto not_there;
  333. #endif
  334.     if (strEQ(name, "B50"))
  335. #ifdef B50
  336.         return B50;
  337. #else
  338.         goto not_there;
  339. #endif
  340.     if (strEQ(name, "B600"))
  341. #ifdef B600
  342.         return B600;
  343. #else
  344.         goto not_there;
  345. #endif
  346.     if (strEQ(name, "B75"))
  347. #ifdef B75
  348.         return B75;
  349. #else
  350.         goto not_there;
  351. #endif
  352.     break;
  353.     case 'C':
  354.     if (strEQ(name, "CHAR_BIT"))
  355. #ifdef CHAR_BIT
  356.         return CHAR_BIT;
  357. #else
  358.         goto not_there;
  359. #endif
  360.     if (strEQ(name, "CHAR_MAX"))
  361. #ifdef CHAR_MAX
  362.         return CHAR_MAX;
  363. #else
  364.         goto not_there;
  365. #endif
  366.     if (strEQ(name, "CHAR_MIN"))
  367. #ifdef CHAR_MIN
  368.         return CHAR_MIN;
  369. #else
  370.         goto not_there;
  371. #endif
  372.     if (strEQ(name, "CHILD_MAX"))
  373. #ifdef CHILD_MAX
  374.         return CHILD_MAX;
  375. #else
  376.         goto not_there;
  377. #endif
  378.     if (strEQ(name, "CLK_TCK"))
  379. #ifdef CLK_TCK
  380.         return CLK_TCK;
  381. #else
  382.         goto not_there;
  383. #endif
  384.     if (strEQ(name, "CLOCAL"))
  385. #ifdef CLOCAL
  386.         return CLOCAL;
  387. #else
  388.         goto not_there;
  389. #endif
  390.     if (strEQ(name, "CLOCKS_PER_SEC"))
  391. #ifdef CLOCKS_PER_SEC
  392.         return CLOCKS_PER_SEC;
  393. #else
  394.         goto not_there;
  395. #endif
  396.     if (strEQ(name, "CREAD"))
  397. #ifdef CREAD
  398.         return CREAD;
  399. #else
  400.         goto not_there;
  401. #endif
  402.     if (strEQ(name, "CS5"))
  403. #ifdef CS5
  404.         return CS5;
  405. #else
  406.         goto not_there;
  407. #endif
  408.     if (strEQ(name, "CS6"))
  409. #ifdef CS6
  410.         return CS6;
  411. #else
  412.         goto not_there;
  413. #endif
  414.     if (strEQ(name, "CS7"))
  415. #ifdef CS7
  416.         return CS7;
  417. #else
  418.         goto not_there;
  419. #endif
  420.     if (strEQ(name, "CS8"))
  421. #ifdef CS8
  422.         return CS8;
  423. #else
  424.         goto not_there;
  425. #endif
  426.     if (strEQ(name, "CSIZE"))
  427. #ifdef CSIZE
  428.         return CSIZE;
  429. #else
  430.         goto not_there;
  431. #endif
  432.     if (strEQ(name, "CSTOPB"))
  433. #ifdef CSTOPB
  434.         return CSTOPB;
  435. #else
  436.         goto not_there;
  437. #endif
  438.     break;
  439.     case 'D':
  440.     if (strEQ(name, "DBL_MAX"))
  441. #ifdef DBL_MAX
  442.         return DBL_MAX;
  443. #else
  444.         goto not_there;
  445. #endif
  446.     if (strEQ(name, "DBL_MIN"))
  447. #ifdef DBL_MIN
  448.         return DBL_MIN;
  449. #else
  450.         goto not_there;
  451. #endif
  452.     if (strEQ(name, "DBL_DIG"))
  453. #ifdef DBL_DIG
  454.         return DBL_DIG;
  455. #else
  456.         goto not_there;
  457. #endif
  458.     if (strEQ(name, "DBL_EPSILON"))
  459. #ifdef DBL_EPSILON
  460.         return DBL_EPSILON;
  461. #else
  462.         goto not_there;
  463. #endif
  464.     if (strEQ(name, "DBL_MANT_DIG"))
  465. #ifdef DBL_MANT_DIG
  466.         return DBL_MANT_DIG;
  467. #else
  468.         goto not_there;
  469. #endif
  470.     if (strEQ(name, "DBL_MAX_10_EXP"))
  471. #ifdef DBL_MAX_10_EXP
  472.         return DBL_MAX_10_EXP;
  473. #else
  474.         goto not_there;
  475. #endif
  476.     if (strEQ(name, "DBL_MAX_EXP"))
  477. #ifdef DBL_MAX_EXP
  478.         return DBL_MAX_EXP;
  479. #else
  480.         goto not_there;
  481. #endif
  482.     if (strEQ(name, "DBL_MIN_10_EXP"))
  483. #ifdef DBL_MIN_10_EXP
  484.         return DBL_MIN_10_EXP;
  485. #else
  486.         goto not_there;
  487. #endif
  488.     if (strEQ(name, "DBL_MIN_EXP"))
  489. #ifdef DBL_MIN_EXP
  490.         return DBL_MIN_EXP;
  491. #else
  492.         goto not_there;
  493. #endif
  494.     break;
  495.     case 'E':
  496.     switch (name[1]) {
  497.     case 'A':
  498.         if (strEQ(name, "EACCES"))
  499. #ifdef EACCES
  500.         return EACCES;
  501. #else
  502.         goto not_there;
  503. #endif
  504.         if (strEQ(name, "EAGAIN"))
  505. #ifdef EAGAIN
  506.         return EAGAIN;
  507. #else
  508.         goto not_there;
  509. #endif
  510.         break;
  511.     case 'B':
  512.         if (strEQ(name, "EBADF"))
  513. #ifdef EBADF
  514.         return EBADF;
  515. #else
  516.         goto not_there;
  517. #endif
  518.         if (strEQ(name, "EBUSY"))
  519. #ifdef EBUSY
  520.         return EBUSY;
  521. #else
  522.         goto not_there;
  523. #endif
  524.         break;
  525.     case 'C':
  526.         if (strEQ(name, "ECHILD"))
  527. #ifdef ECHILD
  528.         return ECHILD;
  529. #else
  530.         goto not_there;
  531. #endif
  532.         if (strEQ(name, "ECHO"))
  533. #ifdef ECHO
  534.         return ECHO;
  535. #else
  536.         goto not_there;
  537. #endif
  538.         if (strEQ(name, "ECHOE"))
  539. #ifdef ECHOE
  540.         return ECHOE;
  541. #else
  542.         goto not_there;
  543. #endif
  544.         if (strEQ(name, "ECHOK"))
  545. #ifdef ECHOK
  546.         return ECHOK;
  547. #else
  548.         goto not_there;
  549. #endif
  550.         if (strEQ(name, "ECHONL"))
  551. #ifdef ECHONL
  552.         return ECHONL;
  553. #else
  554.         goto not_there;
  555. #endif
  556.         break;
  557.     case 'D':
  558.         if (strEQ(name, "EDEADLK"))
  559. #ifdef EDEADLK
  560.         return EDEADLK;
  561. #else
  562.         goto not_there;
  563. #endif
  564.         if (strEQ(name, "EDOM"))
  565. #ifdef EDOM
  566.         return EDOM;
  567. #else
  568.         goto not_there;
  569. #endif
  570.         break;
  571.     case 'E':
  572.         if (strEQ(name, "EEXIST"))
  573. #ifdef EEXIST
  574.         return EEXIST;
  575. #else
  576.         goto not_there;
  577. #endif
  578.         break;
  579.     case 'F':
  580.         if (strEQ(name, "EFAULT"))
  581. #ifdef EFAULT
  582.         return EFAULT;
  583. #else
  584.         goto not_there;
  585. #endif
  586.         if (strEQ(name, "EFBIG"))
  587. #ifdef EFBIG
  588.         return EFBIG;
  589. #else
  590.         goto not_there;
  591. #endif
  592.         break;
  593.     case 'I':
  594.         if (strEQ(name, "EINTR"))
  595. #ifdef EINTR
  596.         return EINTR;
  597. #else
  598.         goto not_there;
  599. #endif
  600.         if (strEQ(name, "EINVAL"))
  601. #ifdef EINVAL
  602.         return EINVAL;
  603. #else
  604.         goto not_there;
  605. #endif
  606.         if (strEQ(name, "EIO"))
  607. #ifdef EIO
  608.         return EIO;
  609. #else
  610.         goto not_there;
  611. #endif
  612.         if (strEQ(name, "EISDIR"))
  613. #ifdef EISDIR
  614.         return EISDIR;
  615. #else
  616.         goto not_there;
  617. #endif
  618.         break;
  619.     case 'M':
  620.         if (strEQ(name, "EMFILE"))
  621. #ifdef EMFILE
  622.         return EMFILE;
  623. #else
  624.         goto not_there;
  625. #endif
  626.         if (strEQ(name, "EMLINK"))
  627. #ifdef EMLINK
  628.         return EMLINK;
  629. #else
  630.         goto not_there;
  631. #endif
  632.         break;
  633.     case 'N':
  634.         if (strEQ(name, "ENOMEM"))
  635. #ifdef ENOMEM
  636.         return ENOMEM;
  637. #else
  638.         goto not_there;
  639. #endif
  640.         if (strEQ(name, "ENOSPC"))
  641. #ifdef ENOSPC
  642.         return ENOSPC;
  643. #else
  644.         goto not_there;
  645. #endif
  646.         if (strEQ(name, "ENOEXEC"))
  647. #ifdef ENOEXEC
  648.         return ENOEXEC;
  649. #else
  650.         goto not_there;
  651. #endif
  652.         if (strEQ(name, "ENOTTY"))
  653. #ifdef ENOTTY
  654.         return ENOTTY;
  655. #else
  656.         goto not_there;
  657. #endif
  658.         if (strEQ(name, "ENOTDIR"))
  659. #ifdef ENOTDIR
  660.         return ENOTDIR;
  661. #else
  662.         goto not_there;
  663. #endif
  664.         if (strEQ(name, "ENOTEMPTY"))
  665. #ifdef ENOTEMPTY
  666.         return ENOTEMPTY;
  667. #else
  668.         goto not_there;
  669. #endif
  670.         if (strEQ(name, "ENFILE"))
  671. #ifdef ENFILE
  672.         return ENFILE;
  673. #else
  674.         goto not_there;
  675. #endif
  676.         if (strEQ(name, "ENODEV"))
  677. #ifdef ENODEV
  678.         return ENODEV;
  679. #else
  680.         goto not_there;
  681. #endif
  682.         if (strEQ(name, "ENOENT"))
  683. #ifdef ENOENT
  684.         return ENOENT;
  685. #else
  686.         goto not_there;
  687. #endif
  688.         if (strEQ(name, "ENOLCK"))
  689. #ifdef ENOLCK
  690.         return ENOLCK;
  691. #else
  692.         goto not_there;
  693. #endif
  694.         if (strEQ(name, "ENOSYS"))
  695. #ifdef ENOSYS
  696.         return ENOSYS;
  697. #else
  698.         goto not_there;
  699. #endif
  700.         if (strEQ(name, "ENXIO"))
  701. #ifdef ENXIO
  702.         return ENXIO;
  703. #else
  704.         goto not_there;
  705. #endif
  706.         if (strEQ(name, "ENAMETOOLONG"))
  707. #ifdef ENAMETOOLONG
  708.         return ENAMETOOLONG;
  709. #else
  710.         goto not_there;
  711. #endif
  712.         break;
  713.     case 'O':
  714.         if (strEQ(name, "EOF"))
  715. #ifdef EOF
  716.         return EOF;
  717. #else
  718.         goto not_there;
  719. #endif
  720.         break;
  721.     case 'P':
  722.         if (strEQ(name, "EPERM"))
  723. #ifdef EPERM
  724.         return EPERM;
  725. #else
  726.         goto not_there;
  727. #endif
  728.         if (strEQ(name, "EPIPE"))
  729. #ifdef EPIPE
  730.         return EPIPE;
  731. #else
  732.         goto not_there;
  733. #endif
  734.         break;
  735.     case 'R':
  736.         if (strEQ(name, "ERANGE"))
  737. #ifdef ERANGE
  738.         return ERANGE;
  739. #else
  740.         goto not_there;
  741. #endif
  742.         if (strEQ(name, "EROFS"))
  743. #ifdef EROFS
  744.         return EROFS;
  745. #else
  746.         goto not_there;
  747. #endif
  748.         break;
  749.     case 'S':
  750.         if (strEQ(name, "ESPIPE"))
  751. #ifdef ESPIPE
  752.         return ESPIPE;
  753. #else
  754.         goto not_there;
  755. #endif
  756.         if (strEQ(name, "ESRCH"))
  757. #ifdef ESRCH
  758.         return ESRCH;
  759. #else
  760.         goto not_there;
  761. #endif
  762.         break;
  763.     case 'X':
  764.         if (strEQ(name, "EXIT_FAILURE"))
  765. #ifdef EXIT_FAILURE
  766.         return EXIT_FAILURE;
  767. #else
  768.         return 1;
  769. #endif
  770.         if (strEQ(name, "EXIT_SUCCESS"))
  771. #ifdef EXIT_SUCCESS
  772.         return EXIT_SUCCESS;
  773. #else
  774.         return 0;
  775. #endif
  776.         if (strEQ(name, "EXDEV"))
  777. #ifdef EXDEV
  778.         return EXDEV;
  779. #else
  780.         goto not_there;
  781. #endif
  782.         break;
  783.     }
  784.     if (strEQ(name, "E2BIG"))
  785. #ifdef E2BIG
  786.         return E2BIG;
  787. #else
  788.         goto not_there;
  789. #endif
  790.     break;
  791.     case 'F':
  792.     if (strnEQ(name, "FLT_", 4)) {
  793.         if (strEQ(name, "FLT_MAX"))
  794. #ifdef FLT_MAX
  795.         return FLT_MAX;
  796. #else
  797.         goto not_there;
  798. #endif
  799.         if (strEQ(name, "FLT_MIN"))
  800. #ifdef FLT_MIN
  801.         return FLT_MIN;
  802. #else
  803.         goto not_there;
  804. #endif
  805.         if (strEQ(name, "FLT_ROUNDS"))
  806. #ifdef FLT_ROUNDS
  807.         return FLT_ROUNDS;
  808. #else
  809.         goto not_there;
  810. #endif
  811.         if (strEQ(name, "FLT_DIG"))
  812. #ifdef FLT_DIG
  813.         return FLT_DIG;
  814. #else
  815.         goto not_there;
  816. #endif
  817.         if (strEQ(name, "FLT_EPSILON"))
  818. #ifdef FLT_EPSILON
  819.         return FLT_EPSILON;
  820. #else
  821.         goto not_there;
  822. #endif
  823.         if (strEQ(name, "FLT_MANT_DIG"))
  824. #ifdef FLT_MANT_DIG
  825.         return FLT_MANT_DIG;
  826. #else
  827.         goto not_there;
  828. #endif
  829.         if (strEQ(name, "FLT_MAX_10_EXP"))
  830. #ifdef FLT_MAX_10_EXP
  831.         return FLT_MAX_10_EXP;
  832. #else
  833.         goto not_there;
  834. #endif
  835.         if (strEQ(name, "FLT_MAX_EXP"))
  836. #ifdef FLT_MAX_EXP
  837.         return FLT_MAX_EXP;
  838. #else
  839.         goto not_there;
  840. #endif
  841.         if (strEQ(name, "FLT_MIN_10_EXP"))
  842. #ifdef FLT_MIN_10_EXP
  843.         return FLT_MIN_10_EXP;
  844. #else
  845.         goto not_there;
  846. #endif
  847.         if (strEQ(name, "FLT_MIN_EXP"))
  848. #ifdef FLT_MIN_EXP
  849.         return FLT_MIN_EXP;
  850. #else
  851.         goto not_there;
  852. #endif
  853.         if (strEQ(name, "FLT_RADIX"))
  854. #ifdef FLT_RADIX
  855.         return FLT_RADIX;
  856. #else
  857.         goto not_there;
  858. #endif
  859.         break;
  860.     }
  861.     if (strnEQ(name, "F_", 2)) {
  862.         if (strEQ(name, "F_DUPFD"))
  863. #ifdef F_DUPFD
  864.         return F_DUPFD;
  865. #else
  866.         goto not_there;
  867. #endif
  868.         if (strEQ(name, "F_GETFD"))
  869. #ifdef F_GETFD
  870.         return F_GETFD;
  871. #else
  872.         goto not_there;
  873. #endif
  874.         if (strEQ(name, "F_GETFL"))
  875. #ifdef F_GETFL
  876.         return F_GETFL;
  877. #else
  878.         goto not_there;
  879. #endif
  880.         if (strEQ(name, "F_GETLK"))
  881. #ifdef F_GETLK
  882.         return F_GETLK;
  883. #else
  884.         goto not_there;
  885. #endif
  886.         if (strEQ(name, "F_OK"))
  887. #ifdef F_OK
  888.         return F_OK;
  889. #else
  890.         goto not_there;
  891. #endif
  892.         if (strEQ(name, "F_RDLCK"))
  893. #ifdef F_RDLCK
  894.         return F_RDLCK;
  895. #else
  896.         goto not_there;
  897. #endif
  898.         if (strEQ(name, "F_SETFD"))
  899. #ifdef F_SETFD
  900.         return F_SETFD;
  901. #else
  902.         goto not_there;
  903. #endif
  904.         if (strEQ(name, "F_SETFL"))
  905. #ifdef F_SETFL
  906.         return F_SETFL;
  907. #else
  908.         goto not_there;
  909. #endif
  910.         if (strEQ(name, "F_SETLK"))
  911. #ifdef F_SETLK
  912.         return F_SETLK;
  913. #else
  914.         goto not_there;
  915. #endif
  916.         if (strEQ(name, "F_SETLKW"))
  917. #ifdef F_SETLKW
  918.         return F_SETLKW;
  919. #else
  920.         goto not_there;
  921. #endif
  922.         if (strEQ(name, "F_UNLCK"))
  923. #ifdef F_UNLCK
  924.         return F_UNLCK;
  925. #else
  926.         goto not_there;
  927. #endif
  928.         if (strEQ(name, "F_WRLCK"))
  929. #ifdef F_WRLCK
  930.         return F_WRLCK;
  931. #else
  932.         goto not_there;
  933. #endif
  934.         break;
  935.     }
  936.     if (strEQ(name, "FD_CLOEXEC")) return FD_CLOEXEC;
  937.     if (strEQ(name, "FILENAME_MAX"))
  938. #ifdef FILENAME_MAX
  939.         return FILENAME_MAX;
  940. #else
  941.         goto not_there;
  942. #endif
  943.     break;
  944.     case 'H':
  945.     if (strEQ(name, "HUGE_VAL"))
  946. #ifdef HUGE_VAL
  947.         return HUGE_VAL;
  948. #else
  949.         goto not_there;
  950. #endif
  951.     if (strEQ(name, "HUPCL"))
  952. #ifdef HUPCL
  953.         return HUPCL;
  954. #else
  955.         goto not_there;
  956. #endif
  957.     break;
  958.     case 'I':
  959.     if (strEQ(name, "INT_MAX"))
  960. #ifdef INT_MAX
  961.         return INT_MAX;
  962. #else
  963.         goto not_there;
  964. #endif
  965.     if (strEQ(name, "INT_MIN"))
  966. #ifdef INT_MIN
  967.         return INT_MIN;
  968. #else
  969.         goto not_there;
  970. #endif
  971.     if (strEQ(name, "ICANON"))
  972. #ifdef ICANON
  973.         return ICANON;
  974. #else
  975.         goto not_there;
  976. #endif
  977.     if (strEQ(name, "ICRNL"))
  978. #ifdef ICRNL
  979.         return ICRNL;
  980. #else
  981.         goto not_there;
  982. #endif
  983.     if (strEQ(name, "IEXTEN"))
  984. #ifdef IEXTEN
  985.         return IEXTEN;
  986. #else
  987.         goto not_there;
  988. #endif
  989.     if (strEQ(name, "IGNBRK"))
  990. #ifdef IGNBRK
  991.         return IGNBRK;
  992. #else
  993.         goto not_there;
  994. #endif
  995.     if (strEQ(name, "IGNCR"))
  996. #ifdef IGNCR
  997.         return IGNCR;
  998. #else
  999.         goto not_there;
  1000. #endif
  1001.     if (strEQ(name, "IGNPAR"))
  1002. #ifdef IGNPAR
  1003.         return IGNPAR;
  1004. #else
  1005.         goto not_there;
  1006. #endif
  1007.     if (strEQ(name, "INLCR"))
  1008. #ifdef INLCR
  1009.         return INLCR;
  1010. #else
  1011.         goto not_there;
  1012. #endif
  1013.     if (strEQ(name, "INPCK"))
  1014. #ifdef INPCK
  1015.         return INPCK;
  1016. #else
  1017.         goto not_there;
  1018. #endif
  1019.     if (strEQ(name, "ISIG"))
  1020. #ifdef ISIG
  1021.         return ISIG;
  1022. #else
  1023.         goto not_there;
  1024. #endif
  1025.     if (strEQ(name, "ISTRIP"))
  1026. #ifdef ISTRIP
  1027.         return ISTRIP;
  1028. #else
  1029.         goto not_there;
  1030. #endif
  1031.     if (strEQ(name, "IXOFF"))
  1032. #ifdef IXOFF
  1033.         return IXOFF;
  1034. #else
  1035.         goto not_there;
  1036. #endif
  1037.     if (strEQ(name, "IXON"))
  1038. #ifdef IXON
  1039.         return IXON;
  1040. #else
  1041.         goto not_there;
  1042. #endif
  1043.     break;
  1044.     case 'L':
  1045.     if (strnEQ(name, "LC_", 3)) {
  1046.         if (strEQ(name, "LC_ALL"))
  1047. #ifdef LC_ALL
  1048.         return LC_ALL;
  1049. #else
  1050.         goto not_there;
  1051. #endif
  1052.         if (strEQ(name, "LC_COLLATE"))
  1053. #ifdef LC_COLLATE
  1054.         return LC_COLLATE;
  1055. #else
  1056.         goto not_there;
  1057. #endif
  1058.         if (strEQ(name, "LC_CTYPE"))
  1059. #ifdef LC_CTYPE
  1060.         return LC_CTYPE;
  1061. #else
  1062.         goto not_there;
  1063. #endif
  1064.         if (strEQ(name, "LC_MONETARY"))
  1065. #ifdef LC_MONETARY
  1066.         return LC_MONETARY;
  1067. #else
  1068.         goto not_there;
  1069. #endif
  1070.         if (strEQ(name, "LC_NUMERIC"))
  1071. #ifdef LC_NUMERIC
  1072.         return LC_NUMERIC;
  1073. #else
  1074.         goto not_there;
  1075. #endif
  1076.         if (strEQ(name, "LC_TIME"))
  1077. #ifdef LC_TIME
  1078.         return LC_TIME;
  1079. #else
  1080.         goto not_there;
  1081. #endif
  1082.         break;
  1083.     }
  1084.     if (strnEQ(name, "LDBL_", 5)) {
  1085.         if (strEQ(name, "LDBL_MAX"))
  1086. #ifdef LDBL_MAX
  1087.         return LDBL_MAX;
  1088. #else
  1089.         goto not_there;
  1090. #endif
  1091.         if (strEQ(name, "LDBL_MIN"))
  1092. #ifdef LDBL_MIN
  1093.         return LDBL_MIN;
  1094. #else
  1095.         goto not_there;
  1096. #endif
  1097.         if (strEQ(name, "LDBL_DIG"))
  1098. #ifdef LDBL_DIG
  1099.         return LDBL_DIG;
  1100. #else
  1101.         goto not_there;
  1102. #endif
  1103.         if (strEQ(name, "LDBL_EPSILON"))
  1104. #ifdef LDBL_EPSILON
  1105.         return LDBL_EPSILON;
  1106. #else
  1107.         goto not_there;
  1108. #endif
  1109.         if (strEQ(name, "LDBL_MANT_DIG"))
  1110. #ifdef LDBL_MANT_DIG
  1111.         return LDBL_MANT_DIG;
  1112. #else
  1113.         goto not_there;
  1114. #endif
  1115.         if (strEQ(name, "LDBL_MAX_10_EXP"))
  1116. #ifdef LDBL_MAX_10_EXP
  1117.         return LDBL_MAX_10_EXP;
  1118. #else
  1119.         goto not_there;
  1120. #endif
  1121.         if (strEQ(name, "LDBL_MAX_EXP"))
  1122. #ifdef LDBL_MAX_EXP
  1123.         return LDBL_MAX_EXP;
  1124. #else
  1125.         goto not_there;
  1126. #endif
  1127.         if (strEQ(name, "LDBL_MIN_10_EXP"))
  1128. #ifdef LDBL_MIN_10_EXP
  1129.         return LDBL_MIN_10_EXP;
  1130. #else
  1131.         goto not_there;
  1132. #endif
  1133.         if (strEQ(name, "LDBL_MIN_EXP"))
  1134. #ifdef LDBL_MIN_EXP
  1135.         return LDBL_MIN_EXP;
  1136. #else
  1137.         goto not_there;
  1138. #endif
  1139.         break;
  1140.     }
  1141.     if (strnEQ(name, "L_", 2)) {
  1142.         if (strEQ(name, "L_ctermid"))
  1143. #ifdef L_ctermid
  1144.         return L_ctermid;
  1145. #else
  1146.         goto not_there;
  1147. #endif
  1148.         if (strEQ(name, "L_cuserid"))
  1149. #ifdef L_cuserid
  1150.         return L_cuserid;
  1151. #else
  1152.         goto not_there;
  1153. #endif
  1154.         if (strEQ(name, "L_tmpname"))
  1155. #ifdef L_tmpname
  1156.         return L_tmpname;
  1157. #else
  1158.         goto not_there;
  1159. #endif
  1160.         break;
  1161.     }
  1162.     if (strEQ(name, "LONG_MAX"))
  1163. #ifdef LONG_MAX
  1164.         return LONG_MAX;
  1165. #else
  1166.         goto not_there;
  1167. #endif
  1168.     if (strEQ(name, "LONG_MIN"))
  1169. #ifdef LONG_MIN
  1170.         return LONG_MIN;
  1171. #else
  1172.         goto not_there;
  1173. #endif
  1174.     if (strEQ(name, "LINK_MAX"))
  1175. #ifdef LINK_MAX
  1176.         return LINK_MAX;
  1177. #else
  1178.         goto not_there;
  1179. #endif
  1180.     break;
  1181.     case 'M':
  1182.     if (strEQ(name, "MAX_CANON"))
  1183. #ifdef MAX_CANON
  1184.         return MAX_CANON;
  1185. #else
  1186.         goto not_there;
  1187. #endif
  1188.     if (strEQ(name, "MAX_INPUT"))
  1189. #ifdef MAX_INPUT
  1190.         return MAX_INPUT;
  1191. #else
  1192.         goto not_there;
  1193. #endif
  1194.     if (strEQ(name, "MB_CUR_MAX"))
  1195. #ifdef MB_CUR_MAX
  1196.         return MB_CUR_MAX;
  1197. #else
  1198.         goto not_there;
  1199. #endif
  1200.     if (strEQ(name, "MB_LEN_MAX"))
  1201. #ifdef MB_LEN_MAX
  1202.         return MB_LEN_MAX;
  1203. #else
  1204.         goto not_there;
  1205. #endif
  1206.     break;
  1207.     case 'N':
  1208.     if (strEQ(name, "NULL")) return 0;
  1209.     if (strEQ(name, "NAME_MAX"))
  1210. #ifdef NAME_MAX
  1211.         return NAME_MAX;
  1212. #else
  1213.         goto not_there;
  1214. #endif
  1215.     if (strEQ(name, "NCCS"))
  1216. #ifdef NCCS
  1217.         return NCCS;
  1218. #else
  1219.         goto not_there;
  1220. #endif
  1221.     if (strEQ(name, "NGROUPS_MAX"))
  1222. #ifdef NGROUPS_MAX
  1223.         return NGROUPS_MAX;
  1224. #else
  1225.         goto not_there;
  1226. #endif
  1227.     if (strEQ(name, "NOFLSH"))
  1228. #ifdef NOFLSH
  1229.         return NOFLSH;
  1230. #else
  1231.         goto not_there;
  1232. #endif
  1233.     break;
  1234.     case 'O':
  1235.     if (strnEQ(name, "O_", 2)) {
  1236.         if (strEQ(name, "O_APPEND"))
  1237. #ifdef O_APPEND
  1238.         return O_APPEND;
  1239. #else
  1240.         goto not_there;
  1241. #endif
  1242.         if (strEQ(name, "O_CREAT"))
  1243. #ifdef O_CREAT
  1244.         return O_CREAT;
  1245. #else
  1246.         goto not_there;
  1247. #endif
  1248.         if (strEQ(name, "O_TRUNC"))
  1249. #ifdef O_TRUNC
  1250.         return O_TRUNC;
  1251. #else
  1252.         goto not_there;
  1253. #endif
  1254.         if (strEQ(name, "O_RDONLY"))
  1255. #ifdef O_RDONLY
  1256.         return O_RDONLY;
  1257. #else
  1258.         goto not_there;
  1259. #endif
  1260.         if (strEQ(name, "O_RDWR"))
  1261. #ifdef O_RDWR
  1262.         return O_RDWR;
  1263. #else
  1264.         goto not_there;
  1265. #endif
  1266.         if (strEQ(name, "O_WRONLY"))
  1267. #ifdef O_WRONLY
  1268.         return O_WRONLY;
  1269. #else
  1270.         goto not_there;
  1271. #endif
  1272.         if (strEQ(name, "O_EXCL"))
  1273. #ifdef O_EXCL
  1274.         return O_EXCL;
  1275. #else
  1276.         goto not_there;
  1277. #endif
  1278.         if (strEQ(name, "O_NOCTTY"))
  1279. #ifdef O_NOCTTY
  1280.         return O_NOCTTY;
  1281. #else
  1282.         goto not_there;
  1283. #endif
  1284.         if (strEQ(name, "O_NONBLOCK"))
  1285. #ifdef O_NONBLOCK
  1286.         return O_NONBLOCK;
  1287. #else
  1288.         goto not_there;
  1289. #endif
  1290.         if (strEQ(name, "O_ACCMODE"))
  1291. #ifdef O_ACCMODE
  1292.         return O_ACCMODE;
  1293. #else
  1294.         goto not_there;
  1295. #endif
  1296.         break;
  1297.     }
  1298.     if (strEQ(name, "OPEN_MAX"))
  1299. #ifdef OPEN_MAX
  1300.         return OPEN_MAX;
  1301. #else
  1302.         goto not_there;
  1303. #endif
  1304.     if (strEQ(name, "OPOST"))
  1305. #ifdef OPOST
  1306.         return OPOST;
  1307. #else
  1308.         goto not_there;
  1309. #endif
  1310.     break;
  1311.     case 'P':
  1312.     if (strEQ(name, "PATH_MAX"))
  1313. #ifdef PATH_MAX
  1314.         return PATH_MAX;
  1315. #else
  1316.         goto not_there;
  1317. #endif
  1318.     if (strEQ(name, "PARENB"))
  1319. #ifdef PARENB
  1320.         return PARENB;
  1321. #else
  1322.         goto not_there;
  1323. #endif
  1324.     if (strEQ(name, "PARMRK"))
  1325. #ifdef PARMRK
  1326.         return PARMRK;
  1327. #else
  1328.         goto not_there;
  1329. #endif
  1330.     if (strEQ(name, "PARODD"))
  1331. #ifdef PARODD
  1332.         return PARODD;
  1333. #else
  1334.         goto not_there;
  1335. #endif
  1336.     if (strEQ(name, "PIPE_BUF"))
  1337. #ifdef PIPE_BUF
  1338.         return PIPE_BUF;
  1339. #else
  1340.         goto not_there;
  1341. #endif
  1342.     break;
  1343.     case 'R':
  1344.     if (strEQ(name, "RAND_MAX"))
  1345. #ifdef RAND_MAX
  1346.         return RAND_MAX;
  1347. #else
  1348.         goto not_there;
  1349. #endif
  1350.     if (strEQ(name, "R_OK"))
  1351. #ifdef R_OK
  1352.         return R_OK;
  1353. #else
  1354.         goto not_there;
  1355. #endif
  1356.     break;
  1357.     case 'S':
  1358.     if (strnEQ(name, "SIG", 3)) {
  1359.         if (name[3] == '_') {
  1360.         if (strEQ(name, "SIG_BLOCK"))
  1361. #ifdef SIG_BLOCK
  1362.             return SIG_BLOCK;
  1363. #else
  1364.             goto not_there;
  1365. #endif
  1366. #ifdef SIG_DFL
  1367.         if (strEQ(name, "SIG_DFL")) return (int)SIG_DFL;
  1368. #endif
  1369. #ifdef SIG_ERR
  1370.         if (strEQ(name, "SIG_ERR")) return (int)SIG_ERR;
  1371. #endif
  1372. #ifdef SIG_IGN
  1373.         if (strEQ(name, "SIG_IGN")) return (int)SIG_IGN;
  1374. #endif
  1375.         if (strEQ(name, "SIG_SETMASK"))
  1376. #ifdef SIG_SETMASK
  1377.             return SIG_SETMASK;
  1378. #else
  1379.             goto not_there;
  1380. #endif
  1381.         if (strEQ(name, "SIG_UNBLOCK"))
  1382. #ifdef SIG_UNBLOCK
  1383.             return SIG_UNBLOCK;
  1384. #else
  1385.             goto not_there;
  1386. #endif
  1387.         break;
  1388.         }
  1389.         if (strEQ(name, "SIGABRT"))
  1390. #ifdef SIGABRT
  1391.         return SIGABRT;
  1392. #else
  1393.         goto not_there;
  1394. #endif
  1395.         if (strEQ(name, "SIGALRM"))
  1396. #ifdef SIGALRM
  1397.         return SIGALRM;
  1398. #else
  1399.         goto not_there;
  1400. #endif
  1401.         if (strEQ(name, "SIGCHLD"))
  1402. #ifdef SIGCHLD
  1403.         return SIGCHLD;
  1404. #else
  1405.         goto not_there;
  1406. #endif
  1407.         if (strEQ(name, "SIGCONT"))
  1408. #ifdef SIGCONT
  1409.         return SIGCONT;
  1410. #else
  1411.         goto not_there;
  1412. #endif
  1413.         if (strEQ(name, "SIGFPE"))
  1414. #ifdef SIGFPE
  1415.         return SIGFPE;
  1416. #else
  1417.         goto not_there;
  1418. #endif
  1419.         if (strEQ(name, "SIGHUP"))
  1420. #ifdef SIGHUP
  1421.         return SIGHUP;
  1422. #else
  1423.         goto not_there;
  1424. #endif
  1425.         if (strEQ(name, "SIGILL"))
  1426. #ifdef SIGILL
  1427.         return SIGILL;
  1428. #else
  1429.         goto not_there;
  1430. #endif
  1431.         if (strEQ(name, "SIGINT"))
  1432. #ifdef SIGINT
  1433.         return SIGINT;
  1434. #else
  1435.         goto not_there;
  1436. #endif
  1437.         if (strEQ(name, "SIGKILL"))
  1438. #ifdef SIGKILL
  1439.         return SIGKILL;
  1440. #else
  1441.         goto not_there;
  1442. #endif
  1443.         if (strEQ(name, "SIGPIPE"))
  1444. #ifdef SIGPIPE
  1445.         return SIGPIPE;
  1446. #else
  1447.         goto not_there;
  1448. #endif
  1449.         if (strEQ(name, "SIGQUIT"))
  1450. #ifdef SIGQUIT
  1451.         return SIGQUIT;
  1452. #else
  1453.         goto not_there;
  1454. #endif
  1455.         if (strEQ(name, "SIGSEGV"))
  1456. #ifdef SIGSEGV
  1457.         return SIGSEGV;
  1458. #else
  1459.         goto not_there;
  1460. #endif
  1461.         if (strEQ(name, "SIGSTOP"))
  1462. #ifdef SIGSTOP
  1463.         return SIGSTOP;
  1464. #else
  1465.         goto not_there;
  1466. #endif
  1467.         if (strEQ(name, "SIGTERM"))
  1468. #ifdef SIGTERM
  1469.         return SIGTERM;
  1470. #else
  1471.         goto not_there;
  1472. #endif
  1473.         if (strEQ(name, "SIGTSTP"))
  1474. #ifdef SIGTSTP
  1475.         return SIGTSTP;
  1476. #else
  1477.         goto not_there;
  1478. #endif
  1479.         if (strEQ(name, "SIGTTIN"))
  1480. #ifdef SIGTTIN
  1481.         return SIGTTIN;
  1482. #else
  1483.         goto not_there;
  1484. #endif
  1485.         if (strEQ(name, "SIGTTOU"))
  1486. #ifdef SIGTTOU
  1487.         return SIGTTOU;
  1488. #else
  1489.         goto not_there;
  1490. #endif
  1491.         if (strEQ(name, "SIGUSR1"))
  1492. #ifdef SIGUSR1
  1493.         return SIGUSR1;
  1494. #else
  1495.         goto not_there;
  1496. #endif
  1497.         if (strEQ(name, "SIGUSR2"))
  1498. #ifdef SIGUSR2
  1499.         return SIGUSR2;
  1500. #else
  1501.         goto not_there;
  1502. #endif
  1503.         break;
  1504.     }
  1505.     if (name[1] == '_') {
  1506. #ifdef S_ISBLK
  1507.         if (strEQ(name, "S_ISBLK")) return S_ISBLK(arg);
  1508. #endif
  1509. #ifdef S_ISCHR
  1510.         if (strEQ(name, "S_ISCHR")) return S_ISCHR(arg);
  1511. #endif
  1512. #ifdef S_ISDIR
  1513.         if (strEQ(name, "S_ISDIR")) return S_ISDIR(arg);
  1514. #endif
  1515. #ifdef S_ISFIFO
  1516.         if (strEQ(name, "S_ISFIFO")) return S_ISFIFO(arg);
  1517. #endif
  1518. #ifdef S_ISREG
  1519.         if (strEQ(name, "S_ISREG")) return S_ISREG(arg);
  1520. #endif
  1521.         if (strEQ(name, "S_ISGID"))
  1522. #ifdef S_ISGID
  1523.         return S_ISGID;
  1524. #else
  1525.         goto not_there;
  1526. #endif
  1527.         if (strEQ(name, "S_ISUID"))
  1528. #ifdef S_ISUID
  1529.         return S_ISUID;
  1530. #else
  1531.         goto not_there;
  1532. #endif
  1533.         if (strEQ(name, "S_IRGRP"))
  1534. #ifdef S_IRGRP
  1535.         return S_IRGRP;
  1536. #else
  1537.         goto not_there;
  1538. #endif
  1539.         if (strEQ(name, "S_IROTH"))
  1540. #ifdef S_IROTH
  1541.         return S_IROTH;
  1542. #else
  1543.         goto not_there;
  1544. #endif
  1545.         if (strEQ(name, "S_IRUSR"))
  1546. #ifdef S_IRUSR
  1547.         return S_IRUSR;
  1548. #else
  1549.         goto not_there;
  1550. #endif
  1551.         if (strEQ(name, "S_IRWXG"))
  1552. #ifdef S_IRWXG
  1553.         return S_IRWXG;
  1554. #else
  1555.         goto not_there;
  1556. #endif
  1557.         if (strEQ(name, "S_IRWXO"))
  1558. #ifdef S_IRWXO
  1559.         return S_IRWXO;
  1560. #else
  1561.         goto not_there;
  1562. #endif
  1563.         if (strEQ(name, "S_IRWXU"))
  1564. #ifdef S_IRWXU
  1565.         return S_IRWXU;
  1566. #else
  1567.         goto not_there;
  1568. #endif
  1569.         if (strEQ(name, "S_IWGRP"))
  1570. #ifdef S_IWGRP
  1571.         return S_IWGRP;
  1572. #else
  1573.         goto not_there;
  1574. #endif
  1575.         if (strEQ(name, "S_IWOTH"))
  1576. #ifdef S_IWOTH
  1577.         return S_IWOTH;
  1578. #else
  1579.         goto not_there;
  1580. #endif
  1581.         if (strEQ(name, "S_IWUSR"))
  1582. #ifdef S_IWUSR
  1583.         return S_IWUSR;
  1584. #else
  1585.         goto not_there;
  1586. #endif
  1587.         if (strEQ(name, "S_IXGRP"))
  1588. #ifdef S_IXGRP
  1589.         return S_IXGRP;
  1590. #else
  1591.         goto not_there;
  1592. #endif
  1593.         if (strEQ(name, "S_IXOTH"))
  1594. #ifdef S_IXOTH
  1595.         return S_IXOTH;
  1596. #else
  1597.         goto not_there;
  1598. #endif
  1599.         if (strEQ(name, "S_IXUSR"))
  1600. #ifdef S_IXUSR
  1601.         return S_IXUSR;
  1602. #else
  1603.         goto not_there;
  1604. #endif
  1605.         break;
  1606.     }
  1607.     if (strEQ(name, "SEEK_CUR"))
  1608. #ifdef SEEK_CUR
  1609.         return SEEK_CUR;
  1610. #else
  1611.         goto not_there;
  1612. #endif
  1613.     if (strEQ(name, "SEEK_END"))
  1614. #ifdef SEEK_END
  1615.         return SEEK_END;
  1616. #else
  1617.         goto not_there;
  1618. #endif
  1619.     if (strEQ(name, "SEEK_SET"))
  1620. #ifdef SEEK_SET
  1621.         return SEEK_SET;
  1622. #else
  1623.         goto not_there;
  1624. #endif
  1625.     if (strEQ(name, "STREAM_MAX"))
  1626. #ifdef STREAM_MAX
  1627.         return STREAM_MAX;
  1628. #else
  1629.         goto not_there;
  1630. #endif
  1631.     if (strEQ(name, "SHRT_MAX"))
  1632. #ifdef SHRT_MAX
  1633.         return SHRT_MAX;
  1634. #else
  1635.         goto not_there;
  1636. #endif
  1637.     if (strEQ(name, "SHRT_MIN"))
  1638. #ifdef SHRT_MIN
  1639.         return SHRT_MIN;
  1640. #else
  1641.         goto not_there;
  1642. #endif
  1643.     if (strEQ(name, "SA_NOCLDSTOP"))
  1644. #ifdef SA_NOCLDSTOP
  1645.         return SA_NOCLDSTOP;
  1646. #else
  1647.         goto not_there;
  1648. #endif
  1649.     if (strEQ(name, "SCHAR_MAX"))
  1650. #ifdef SCHAR_MAX
  1651.         return SCHAR_MAX;
  1652. #else
  1653.         goto not_there;
  1654. #endif
  1655.     if (strEQ(name, "SCHAR_MIN"))
  1656. #ifdef SCHAR_MIN
  1657.         return SCHAR_MIN;
  1658. #else
  1659.         goto not_there;
  1660. #endif
  1661.     if (strEQ(name, "SSIZE_MAX"))
  1662. #ifdef SSIZE_MAX
  1663.         return SSIZE_MAX;
  1664. #else
  1665.         goto not_there;
  1666. #endif
  1667.     if (strEQ(name, "STDIN_FILENO"))
  1668. #ifdef STDIN_FILENO
  1669.         return STDIN_FILENO;
  1670. #else
  1671.         goto not_there;
  1672. #endif
  1673.     if (strEQ(name, "STDOUT_FILENO"))
  1674. #ifdef STDOUT_FILENO
  1675.         return STDOUT_FILENO;
  1676. #else
  1677.         goto not_there;
  1678. #endif
  1679.     if (strEQ(name, "STRERR_FILENO"))
  1680. #ifdef STRERR_FILENO
  1681.         return STRERR_FILENO;
  1682. #else
  1683.         goto not_there;
  1684. #endif
  1685.     break;
  1686.     case 'T':
  1687.     if (strEQ(name, "TCIFLUSH"))
  1688. #ifdef TCIFLUSH
  1689.         return TCIFLUSH;
  1690. #else
  1691.         goto not_there;
  1692. #endif
  1693.     if (strEQ(name, "TCIOFF"))
  1694. #ifdef TCIOFF
  1695.         return TCIOFF;
  1696. #else
  1697.         goto not_there;
  1698. #endif
  1699.     if (strEQ(name, "TCIOFLUSH"))
  1700. #ifdef TCIOFLUSH
  1701.         return TCIOFLUSH;
  1702. #else
  1703.         goto not_there;
  1704. #endif
  1705.     if (strEQ(name, "TCION"))
  1706. #ifdef TCION
  1707.         return TCION;
  1708. #else
  1709.         goto not_there;
  1710. #endif
  1711.     if (strEQ(name, "TCOFLUSH"))
  1712. #ifdef TCOFLUSH
  1713.         return TCOFLUSH;
  1714. #else
  1715.         goto not_there;
  1716. #endif
  1717.     if (strEQ(name, "TCOOFF"))
  1718. #ifdef TCOOFF
  1719.         return TCOOFF;
  1720. #else
  1721.         goto not_there;
  1722. #endif
  1723.     if (strEQ(name, "TCOON"))
  1724. #ifdef TCOON
  1725.         return TCOON;
  1726. #else
  1727.         goto not_there;
  1728. #endif
  1729.     if (strEQ(name, "TCSADRAIN"))
  1730. #ifdef TCSADRAIN
  1731.         return TCSADRAIN;
  1732. #else
  1733.         goto not_there;
  1734. #endif
  1735.     if (strEQ(name, "TCSAFLUSH"))
  1736. #ifdef TCSAFLUSH
  1737.         return TCSAFLUSH;
  1738. #else
  1739.         goto not_there;
  1740. #endif
  1741.     if (strEQ(name, "TCSANOW"))
  1742. #ifdef TCSANOW
  1743.         return TCSANOW;
  1744. #else
  1745.         goto not_there;
  1746. #endif
  1747.     if (strEQ(name, "TMP_MAX"))
  1748. #ifdef TMP_MAX
  1749.         return TMP_MAX;
  1750. #else
  1751.         goto not_there;
  1752. #endif
  1753.     if (strEQ(name, "TOSTOP"))
  1754. #ifdef TOSTOP
  1755.         return TOSTOP;
  1756. #else
  1757.         goto not_there;
  1758. #endif
  1759.     if (strEQ(name, "TZNAME_MAX"))
  1760. #ifdef TZNAME_MAX
  1761.         return TZNAME_MAX;
  1762. #else
  1763.         goto not_there;
  1764. #endif
  1765.     break;
  1766.     case 'U':
  1767.     if (strEQ(name, "UCHAR_MAX"))
  1768. #ifdef UCHAR_MAX
  1769.         return UCHAR_MAX;
  1770. #else
  1771.         goto not_there;
  1772. #endif
  1773.     if (strEQ(name, "UINT_MAX"))
  1774. #ifdef UINT_MAX
  1775.         return UINT_MAX;
  1776. #else
  1777.         goto not_there;
  1778. #endif
  1779.     if (strEQ(name, "ULONG_MAX"))
  1780. #ifdef ULONG_MAX
  1781.         return ULONG_MAX;
  1782. #else
  1783.         goto not_there;
  1784. #endif
  1785.     if (strEQ(name, "USHRT_MAX"))
  1786. #ifdef USHRT_MAX
  1787.         return USHRT_MAX;
  1788. #else
  1789.         goto not_there;
  1790. #endif
  1791.     break;
  1792.     case 'V':
  1793.     if (strEQ(name, "VEOF"))
  1794. #ifdef VEOF
  1795.         return VEOF;
  1796. #else
  1797.         goto not_there;
  1798. #endif
  1799.     if (strEQ(name, "VEOL"))
  1800. #ifdef VEOL
  1801.         return VEOL;
  1802. #else
  1803.         goto not_there;
  1804. #endif
  1805.     if (strEQ(name, "VERASE"))
  1806. #ifdef VERASE
  1807.         return VERASE;
  1808. #else
  1809.         goto not_there;
  1810. #endif
  1811.     if (strEQ(name, "VINTR"))
  1812. #ifdef VINTR
  1813.         return VINTR;
  1814. #else
  1815.         goto not_there;
  1816. #endif
  1817.     if (strEQ(name, "VKILL"))
  1818. #ifdef VKILL
  1819.         return VKILL;
  1820. #else
  1821.         goto not_there;
  1822. #endif
  1823.     if (strEQ(name, "VMIN"))
  1824. #ifdef VMIN
  1825.         return VMIN;
  1826. #else
  1827.         goto not_there;
  1828. #endif
  1829.     if (strEQ(name, "VQUIT"))
  1830. #ifdef VQUIT
  1831.         return VQUIT;
  1832. #else
  1833.         goto not_there;
  1834. #endif
  1835.     if (strEQ(name, "VSTART"))
  1836. #ifdef VSTART
  1837.         return VSTART;
  1838. #else
  1839.         goto not_there;
  1840. #endif
  1841.     if (strEQ(name, "VSTOP"))
  1842. #ifdef VSTOP
  1843.         return VSTOP;
  1844. #else
  1845.         goto not_there;
  1846. #endif
  1847.     if (strEQ(name, "VSUSP"))
  1848. #ifdef VSUSP
  1849.         return VSUSP;
  1850. #else
  1851.         goto not_there;
  1852. #endif
  1853.     if (strEQ(name, "VTIME"))
  1854. #ifdef VTIME
  1855.         return VTIME;
  1856. #else
  1857.         goto not_there;
  1858. #endif
  1859.     break;
  1860.     case 'W':
  1861.     if (strEQ(name, "W_OK"))
  1862. #ifdef W_OK
  1863.         return W_OK;
  1864. #else
  1865.         goto not_there;
  1866. #endif
  1867. #ifdef WEXITSTATUS
  1868.     if (strEQ(name, "WEXITSTATUS")) return WEXITSTATUS(arg);
  1869. #endif
  1870. #ifdef WIFEXITED
  1871.     if (strEQ(name, "WIFEXITED")) return WIFEXITED(arg);
  1872. #endif
  1873. #ifdef WIFSIGNALED
  1874.     if (strEQ(name, "WIFSIGNALED")) return WIFSIGNALED(arg);
  1875. #endif
  1876. #ifdef WIFSTOPPED
  1877.     if (strEQ(name, "WIFSTOPPED")) return WIFSTOPPED(arg);
  1878. #endif
  1879.     if (strEQ(name, "WNOHANG"))
  1880. #ifdef WNOHANG
  1881.         return WNOHANG;
  1882. #else
  1883.         goto not_there;
  1884. #endif
  1885. #ifdef WSTOPSIG
  1886.     if (strEQ(name, "WSTOPSIG")) return WSTOPSIG(arg);
  1887. #endif
  1888. #ifdef WTERMSIG
  1889.     if (strEQ(name, "WTERMSIG")) return WTERMSIG(arg);
  1890. #endif
  1891.     if (strEQ(name, "WUNTRACED"))
  1892. #ifdef WUNTRACED
  1893.         return WUNTRACED;
  1894. #else
  1895.         goto not_there;
  1896. #endif
  1897.     break;
  1898.     case 'X':
  1899.     if (strEQ(name, "X_OK"))
  1900. #ifdef X_OK
  1901.         return X_OK;
  1902. #else
  1903.         goto not_there;
  1904. #endif
  1905.     break;
  1906.     case '_':
  1907.     if (strnEQ(name, "_PC_", 4)) {
  1908.         if (strEQ(name, "_PC_CHOWN_RESTRICTED"))
  1909. #ifdef _PC_CHOWN_RESTRICTED
  1910.         return _PC_CHOWN_RESTRICTED;
  1911. #else
  1912.         goto not_there;
  1913. #endif
  1914.         if (strEQ(name, "_PC_LINK_MAX"))
  1915. #ifdef _PC_LINK_MAX
  1916.         return _PC_LINK_MAX;
  1917. #else
  1918.         goto not_there;
  1919. #endif
  1920.         if (strEQ(name, "_PC_MAX_CANON"))
  1921. #ifdef _PC_MAX_CANON
  1922.         return _PC_MAX_CANON;
  1923. #else
  1924.         goto not_there;
  1925. #endif
  1926.         if (strEQ(name, "_PC_MAX_INPUT"))
  1927. #ifdef _PC_MAX_INPUT
  1928.         return _PC_MAX_INPUT;
  1929. #else
  1930.         goto not_there;
  1931. #endif
  1932.         if (strEQ(name, "_PC_NAME_MAX"))
  1933. #ifdef _PC_NAME_MAX
  1934.         return _PC_NAME_MAX;
  1935. #else
  1936.         goto not_there;
  1937. #endif
  1938.         if (strEQ(name, "_PC_NO_TRUNC"))
  1939. #ifdef _PC_NO_TRUNC
  1940.         return _PC_NO_TRUNC;
  1941. #else
  1942.         goto not_there;
  1943. #endif
  1944.         if (strEQ(name, "_PC_PATH_MAX"))
  1945. #ifdef _PC_PATH_MAX
  1946.         return _PC_PATH_MAX;
  1947. #else
  1948.         goto not_there;
  1949. #endif
  1950.         if (strEQ(name, "_PC_PIPE_BUF"))
  1951. #ifdef _PC_PIPE_BUF
  1952.         return _PC_PIPE_BUF;
  1953. #else
  1954.         goto not_there;
  1955. #endif
  1956.         if (strEQ(name, "_PC_VDISABLE"))
  1957. #ifdef _PC_VDISABLE
  1958.         return _PC_VDISABLE;
  1959. #else
  1960.         goto not_there;
  1961. #endif
  1962.         break;
  1963.     }
  1964.     if (strnEQ(name, "_POSIX_", 7)) {
  1965.         if (strEQ(name, "_POSIX_ARG_MAX"))
  1966. #ifdef _POSIX_ARG_MAX
  1967.         return _POSIX_ARG_MAX;
  1968. #else
  1969.         return 0;
  1970. #endif
  1971.         if (strEQ(name, "_POSIX_CHILD_MAX"))
  1972. #ifdef _POSIX_CHILD_MAX
  1973.         return _POSIX_CHILD_MAX;
  1974. #else
  1975.         return 0;
  1976. #endif
  1977.         if (strEQ(name, "_POSIX_CHOWN_RESTRICTED"))
  1978. #ifdef _POSIX_CHOWN_RESTRICTED
  1979.         return _POSIX_CHOWN_RESTRICTED;
  1980. #else
  1981.         return 0;
  1982. #endif
  1983.         if (strEQ(name, "_POSIX_JOB_CONTROL"))
  1984. #ifdef _POSIX_JOB_CONTROL
  1985.         return _POSIX_JOB_CONTROL;
  1986. #else
  1987.         return 0;
  1988. #endif
  1989.         if (strEQ(name, "_POSIX_LINK_MAX"))
  1990. #ifdef _POSIX_LINK_MAX
  1991.         return _POSIX_LINK_MAX;
  1992. #else
  1993.         return 0;
  1994. #endif
  1995.         if (strEQ(name, "_POSIX_MAX_CANON"))
  1996. #ifdef _POSIX_MAX_CANON
  1997.         return _POSIX_MAX_CANON;
  1998. #else
  1999.         return 0;
  2000. #endif
  2001.         if (strEQ(name, "_POSIX_MAX_INPUT"))
  2002. #ifdef _POSIX_MAX_INPUT
  2003.         return _POSIX_MAX_INPUT;
  2004. #else
  2005.         return 0;
  2006. #endif
  2007.         if (strEQ(name, "_POSIX_NAME_MAX"))
  2008. #ifdef _POSIX_NAME_MAX
  2009.         return _POSIX_NAME_MAX;
  2010. #else
  2011.         return 0;
  2012. #endif
  2013.         if (strEQ(name, "_POSIX_NGROUPS_MAX"))
  2014. #ifdef _POSIX_NGROUPS_MAX
  2015.         return _POSIX_NGROUPS_MAX;
  2016. #else
  2017.         return 0;
  2018. #endif
  2019.         if (strEQ(name, "_POSIX_NO_TRUNC"))
  2020. #ifdef _POSIX_NO_TRUNC
  2021.         return _POSIX_NO_TRUNC;
  2022. #else
  2023.         return 0;
  2024. #endif
  2025.         if (strEQ(name, "_POSIX_OPEN_MAX"))
  2026. #ifdef _POSIX_OPEN_MAX
  2027.         return _POSIX_OPEN_MAX;
  2028. #else
  2029.         return 0;
  2030. #endif
  2031.         if (strEQ(name, "_POSIX_PATH_MAX"))
  2032. #ifdef _POSIX_PATH_MAX
  2033.         return _POSIX_PATH_MAX;
  2034. #else
  2035.         return 0;
  2036. #endif
  2037.         if (strEQ(name, "_POSIX_PIPE_BUF"))
  2038. #ifdef _POSIX_PIPE_BUF
  2039.         return _POSIX_PIPE_BUF;
  2040. #else
  2041.         return 0;
  2042. #endif
  2043.         if (strEQ(name, "_POSIX_SAVED_IDS"))
  2044. #ifdef _POSIX_SAVED_IDS
  2045.         return _POSIX_SAVED_IDS;
  2046. #else
  2047.         return 0;
  2048. #endif
  2049.         if (strEQ(name, "_POSIX_SSIZE_MAX"))
  2050. #ifdef _POSIX_SSIZE_MAX
  2051.         return _POSIX_SSIZE_MAX;
  2052. #else
  2053.         return 0;
  2054. #endif
  2055.         if (strEQ(name, "_POSIX_STREAM_MAX"))
  2056. #ifdef _POSIX_STREAM_MAX
  2057.         return _POSIX_STREAM_MAX;
  2058. #else
  2059.         return 0;
  2060. #endif
  2061.         if (strEQ(name, "_POSIX_TZNAME_MAX"))
  2062. #ifdef _POSIX_TZNAME_MAX
  2063.         return _POSIX_TZNAME_MAX;
  2064. #else
  2065.         return 0;
  2066. #endif
  2067.         if (strEQ(name, "_POSIX_VDISABLE"))
  2068. #ifdef _POSIX_VDISABLE
  2069.         return _POSIX_VDISABLE;
  2070. #else
  2071.         return 0;
  2072. #endif
  2073.         if (strEQ(name, "_POSIX_VERSION"))
  2074. #ifdef _POSIX_VERSION
  2075.         return _POSIX_VERSION;
  2076. #else
  2077.         return 0;
  2078. #endif
  2079.         break;
  2080.     }
  2081.     if (strnEQ(name, "_SC_", 4)) {
  2082.         if (strEQ(name, "_SC_ARG_MAX"))
  2083. #ifdef _SC_ARG_MAX
  2084.         return _SC_ARG_MAX;
  2085. #else
  2086.         goto not_there;
  2087. #endif
  2088.         if (strEQ(name, "_SC_CHILD_MAX"))
  2089. #ifdef _SC_CHILD_MAX
  2090.         return _SC_CHILD_MAX;
  2091. #else
  2092.         goto not_there;
  2093. #endif
  2094.         if (strEQ(name, "_SC_CLK_TCK"))
  2095. #ifdef _SC_CLK_TCK
  2096.         return _SC_CLK_TCK;
  2097. #else
  2098.         goto not_there;
  2099. #endif
  2100.         if (strEQ(name, "_SC_JOB_CONTROL"))
  2101. #ifdef _SC_JOB_CONTROL
  2102.         return _SC_JOB_CONTROL;
  2103. #else
  2104.         goto not_there;
  2105. #endif
  2106.         if (strEQ(name, "_SC_NGROUPS_MAX"))
  2107. #ifdef _SC_NGROUPS_MAX
  2108.         return _SC_NGROUPS_MAX;
  2109. #else
  2110.         goto not_there;
  2111. #endif
  2112.         if (strEQ(name, "_SC_OPEN_MAX"))
  2113. #ifdef _SC_OPEN_MAX
  2114.         return _SC_OPEN_MAX;
  2115. #else
  2116.         goto not_there;
  2117. #endif
  2118.         if (strEQ(name, "_SC_SAVED_IDS"))
  2119. #ifdef _SC_SAVED_IDS
  2120.         return _SC_SAVED_IDS;
  2121. #else
  2122.         goto not_there;
  2123. #endif
  2124.         if (strEQ(name, "_SC_STREAM_MAX"))
  2125. #ifdef _SC_STREAM_MAX
  2126.         return _SC_STREAM_MAX;
  2127. #else
  2128.         goto not_there;
  2129. #endif
  2130.         if (strEQ(name, "_SC_TZNAME_MAX"))
  2131. #ifdef _SC_TZNAME_MAX
  2132.         return _SC_TZNAME_MAX;
  2133. #else
  2134.         goto not_there;
  2135. #endif
  2136.         if (strEQ(name, "_SC_VERSION"))
  2137. #ifdef _SC_VERSION
  2138.         return _SC_VERSION;
  2139. #else
  2140.         goto not_there;
  2141. #endif
  2142.         break;
  2143.     }
  2144.     if (strEQ(name, "_IOFBF"))
  2145. #ifdef _IOFBF
  2146.         return _IOFBF;
  2147. #else
  2148.         goto not_there;
  2149. #endif
  2150.     if (strEQ(name, "_IOLBF"))
  2151. #ifdef _IOLBF
  2152.         return _IOLBF;
  2153. #else
  2154.         goto not_there;
  2155. #endif
  2156.     if (strEQ(name, "_IONBF"))
  2157. #ifdef _IONBF
  2158.         return _IONBF;
  2159. #else
  2160.         goto not_there;
  2161. #endif
  2162.     break;
  2163.     }
  2164.     errno = EINVAL;
  2165.     return 0;
  2166.  
  2167. not_there:
  2168.     errno = ENOENT;
  2169.     return 0;
  2170. }
  2171.  
  2172. MODULE = SigSet        PACKAGE = POSIX::SigSet        PREFIX = sig
  2173.  
  2174. POSIX::SigSet
  2175. new(packname = "POSIX::SigSet", ...)
  2176.     char *        packname
  2177.     CODE:
  2178.     {
  2179.         int i;
  2180.         RETVAL = (sigset_t*)safemalloc(sizeof(sigset_t));
  2181.         sigemptyset(RETVAL);
  2182.         for (i = 1; i < items; i++)
  2183.         sigaddset(RETVAL, SvIV(ST(i)));
  2184.     }
  2185.     OUTPUT:
  2186.     RETVAL
  2187.  
  2188. void
  2189. DESTROY(sigset)
  2190.     POSIX::SigSet    sigset
  2191.     CODE:
  2192.     safefree((char *)sigset);
  2193.  
  2194. SysRet
  2195. sigaddset(sigset, sig)
  2196.     POSIX::SigSet    sigset
  2197.     int        sig
  2198.  
  2199. SysRet
  2200. sigdelset(sigset, sig)
  2201.     POSIX::SigSet    sigset
  2202.     int        sig
  2203.  
  2204. SysRet
  2205. sigemptyset(sigset)
  2206.     POSIX::SigSet    sigset
  2207.  
  2208. SysRet
  2209. sigfillset(sigset)
  2210.     POSIX::SigSet    sigset
  2211.  
  2212. int
  2213. sigismember(sigset, sig)
  2214.     POSIX::SigSet    sigset
  2215.     int        sig
  2216.  
  2217.  
  2218. MODULE = Termios    PACKAGE = POSIX::Termios    PREFIX = cf
  2219.  
  2220. POSIX::Termios
  2221. new(packname = "POSIX::Termios", ...)
  2222.     char *        packname
  2223.     CODE:
  2224.     {
  2225. #ifdef I_TERMIOS
  2226.         RETVAL = (struct termios*)safemalloc(sizeof(struct termios));
  2227. #else
  2228.         not_here("termios");
  2229. #endif
  2230.     }
  2231.     OUTPUT:
  2232.     RETVAL
  2233.  
  2234. void
  2235. DESTROY(termios_ref)
  2236.     POSIX::Termios    termios_ref
  2237.     CODE:
  2238. #ifdef I_TERMIOS
  2239.     safefree((char *)termios_ref);
  2240. #else
  2241.         not_here("termios");
  2242. #endif
  2243.  
  2244. SysRet
  2245. getattr(termios_ref, fd = 0)
  2246.     POSIX::Termios    termios_ref
  2247.     int        fd
  2248.     CODE:
  2249.     RETVAL = tcgetattr(fd, termios_ref);
  2250.     OUTPUT:
  2251.     RETVAL
  2252.  
  2253. SysRet
  2254. setattr(termios_ref, fd = 0, optional_actions = 0)
  2255.     POSIX::Termios    termios_ref
  2256.     int        fd
  2257.     int        optional_actions
  2258.     CODE:
  2259.     RETVAL = tcsetattr(fd, optional_actions, termios_ref);
  2260.     OUTPUT:
  2261.     RETVAL
  2262.  
  2263. speed_t
  2264. cfgetispeed(termios_ref)
  2265.     POSIX::Termios    termios_ref
  2266.  
  2267. speed_t
  2268. cfgetospeed(termios_ref)
  2269.     POSIX::Termios    termios_ref
  2270.  
  2271. tcflag_t
  2272. getiflag(termios_ref)
  2273.     POSIX::Termios    termios_ref
  2274.     CODE:
  2275. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2276.     RETVAL = termios_ref->c_iflag;
  2277. #else
  2278.         not_here("getiflag");
  2279. #endif
  2280.     OUTPUT:
  2281.     RETVAL
  2282.  
  2283. tcflag_t
  2284. getoflag(termios_ref)
  2285.     POSIX::Termios    termios_ref
  2286.     CODE:
  2287. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2288.     RETVAL = termios_ref->c_oflag;
  2289. #else
  2290.         not_here("getoflag");
  2291. #endif
  2292.     OUTPUT:
  2293.     RETVAL
  2294.  
  2295. tcflag_t
  2296. getcflag(termios_ref)
  2297.     POSIX::Termios    termios_ref
  2298.     CODE:
  2299. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2300.     RETVAL = termios_ref->c_cflag;
  2301. #else
  2302.         not_here("getcflag");
  2303. #endif
  2304.     OUTPUT:
  2305.     RETVAL
  2306.  
  2307. tcflag_t
  2308. getlflag(termios_ref)
  2309.     POSIX::Termios    termios_ref
  2310.     CODE:
  2311. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2312.     RETVAL = termios_ref->c_lflag;
  2313. #else
  2314.         not_here("getlflag");
  2315. #endif
  2316.     OUTPUT:
  2317.     RETVAL
  2318.  
  2319. cc_t
  2320. getcc(termios_ref, ccix)
  2321.     POSIX::Termios    termios_ref
  2322.     int        ccix
  2323.     CODE:
  2324. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2325.     if (ccix >= NCCS)
  2326.         croak("Bad getcc subscript");
  2327.     RETVAL = termios_ref->c_cc[ccix];
  2328. #else
  2329.         not_here("getcc");
  2330. #endif
  2331.     OUTPUT:
  2332.     RETVAL
  2333.  
  2334. SysRet
  2335. cfsetispeed(termios_ref, speed)
  2336.     POSIX::Termios    termios_ref
  2337.     speed_t        speed
  2338.  
  2339. SysRet
  2340. cfsetospeed(termios_ref, speed)
  2341.     POSIX::Termios    termios_ref
  2342.     speed_t        speed
  2343.  
  2344. void
  2345. setiflag(termios_ref, iflag)
  2346.     POSIX::Termios    termios_ref
  2347.     tcflag_t    iflag
  2348.     CODE:
  2349. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2350.     termios_ref->c_iflag = iflag;
  2351. #else
  2352.         not_here("setiflag");
  2353. #endif
  2354.  
  2355. void
  2356. setoflag(termios_ref, oflag)
  2357.     POSIX::Termios    termios_ref
  2358.     tcflag_t    oflag
  2359.     CODE:
  2360. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2361.     termios_ref->c_oflag = oflag;
  2362. #else
  2363.         not_here("setoflag");
  2364. #endif
  2365.  
  2366. void
  2367. setcflag(termios_ref, cflag)
  2368.     POSIX::Termios    termios_ref
  2369.     tcflag_t    cflag
  2370.     CODE:
  2371. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2372.     termios_ref->c_cflag = cflag;
  2373. #else
  2374.         not_here("setcflag");
  2375. #endif
  2376.  
  2377. void
  2378. setlflag(termios_ref, lflag)
  2379.     POSIX::Termios    termios_ref
  2380.     tcflag_t    lflag
  2381.     CODE:
  2382. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2383.     termios_ref->c_lflag = lflag;
  2384. #else
  2385.         not_here("setlflag");
  2386. #endif
  2387.  
  2388. void
  2389. setcc(termios_ref, ccix, cc)
  2390.     POSIX::Termios    termios_ref
  2391.     int        ccix
  2392.     cc_t        cc
  2393.     CODE:
  2394. #ifdef I_TERMIOS /* References a termios structure member so ifdef it out. */
  2395.     if (ccix >= NCCS)
  2396.         croak("Bad setcc subscript");
  2397.     termios_ref->c_cc[ccix] = cc;
  2398. #else
  2399.         not_here("setcc");
  2400. #endif
  2401.  
  2402.  
  2403.  
  2404. MODULE = FileHandle    PACKAGE = FileHandle    PREFIX = f
  2405.  
  2406. SV *
  2407. fgetpos(handle)
  2408.     InputStream    handle
  2409.     CODE:
  2410.     {
  2411.         Fpos_t pos;
  2412.         fgetpos(handle, &pos);
  2413.         ST(0) = sv_2mortal(newSVpv((char*)&pos, sizeof(Fpos_t)));
  2414.     }
  2415.  
  2416. SysRet
  2417. fsetpos(handle, pos)
  2418.     InputStream    handle
  2419.     SV *        pos
  2420.     CODE:
  2421.     RETVAL = fsetpos(handle, (Fpos_t*)SvPVX(pos));
  2422.     OUTPUT:
  2423.     RETVAL
  2424.  
  2425. int
  2426. ungetc(handle, c)
  2427.     InputStream    handle
  2428.     int        c
  2429.     CODE:
  2430.     RETVAL = ungetc(c, handle);
  2431.     OUTPUT:
  2432.     RETVAL
  2433.  
  2434. OutputStream
  2435. new_tmpfile()
  2436.     CODE:
  2437.     RETVAL = tmpfile();
  2438.     OUTPUT:
  2439.     RETVAL
  2440.  
  2441. int
  2442. ferror(handle)
  2443.     InputStream    handle
  2444.  
  2445. SysRet
  2446. fflush(handle)
  2447.     OutputStream    handle
  2448.  
  2449. void
  2450. setbuf(handle, buf)
  2451.     OutputStream    handle
  2452.     char *        buf = SvPOK(ST(1)) ? sv_grow(ST(1), BUFSIZ) : 0;
  2453.  
  2454. SysRet
  2455. setvbuf(handle, buf, type, size)
  2456.     OutputStream    handle
  2457.     char *        buf = SvPOK(ST(1)) ? sv_grow(ST(1), SvIV(ST(3))) : 0;
  2458.     int        type
  2459.     int        size
  2460.  
  2461. MODULE = POSIX        PACKAGE = POSIX
  2462.  
  2463. double
  2464. constant(name,arg)
  2465.     char *        name
  2466.     int        arg
  2467.  
  2468. int
  2469. isalnum(charstring)
  2470.     char *        charstring
  2471.     CODE:
  2472.     char *s;
  2473.     RETVAL = 1;
  2474.     for (s = charstring; *s && RETVAL; s++)
  2475.         if (!isalnum(*s))
  2476.         RETVAL = 0;
  2477.     OUTPUT:
  2478.     RETVAL
  2479.  
  2480. int
  2481. isalpha(charstring)
  2482.     char *        charstring
  2483.     CODE:
  2484.     char *s;
  2485.     RETVAL = 1;
  2486.     for (s = charstring; *s && RETVAL; s++)
  2487.         if (!isalpha(*s))
  2488.         RETVAL = 0;
  2489.     OUTPUT:
  2490.     RETVAL
  2491.  
  2492. int
  2493. iscntrl(charstring)
  2494.     char *        charstring
  2495.     CODE:
  2496.     char *s;
  2497.     RETVAL = 1;
  2498.     for (s = charstring; *s && RETVAL; s++)
  2499.         if (!iscntrl(*s))
  2500.         RETVAL = 0;
  2501.     OUTPUT:
  2502.     RETVAL
  2503.  
  2504. int
  2505. isdigit(charstring)
  2506.     char *        charstring
  2507.     CODE:
  2508.     char *s;
  2509.     RETVAL = 1;
  2510.     for (s = charstring; *s && RETVAL; s++)
  2511.         if (!isdigit(*s))
  2512.         RETVAL = 0;
  2513.     OUTPUT:
  2514.     RETVAL
  2515.  
  2516. int
  2517. isgraph(charstring)
  2518.     char *        charstring
  2519.     CODE:
  2520.     char *s;
  2521.     RETVAL = 1;
  2522.     for (s = charstring; *s && RETVAL; s++)
  2523.         if (!isgraph(*s))
  2524.         RETVAL = 0;
  2525.     OUTPUT:
  2526.     RETVAL
  2527.  
  2528. int
  2529. islower(charstring)
  2530.     char *        charstring
  2531.     CODE:
  2532.     char *s;
  2533.     RETVAL = 1;
  2534.     for (s = charstring; *s && RETVAL; s++)
  2535.         if (!islower(*s))
  2536.         RETVAL = 0;
  2537.     OUTPUT:
  2538.     RETVAL
  2539.  
  2540. int
  2541. isprint(charstring)
  2542.     char *        charstring
  2543.     CODE:
  2544.     char *s;
  2545.     RETVAL = 1;
  2546.     for (s = charstring; *s && RETVAL; s++)
  2547.         if (!isprint(*s))
  2548.         RETVAL = 0;
  2549.     OUTPUT:
  2550.     RETVAL
  2551.  
  2552. int
  2553. ispunct(charstring)
  2554.     char *        charstring
  2555.     CODE:
  2556.     char *s;
  2557.     RETVAL = 1;
  2558.     for (s = charstring; *s && RETVAL; s++)
  2559.         if (!ispunct(*s))
  2560.         RETVAL = 0;
  2561.     OUTPUT:
  2562.     RETVAL
  2563.  
  2564. int
  2565. isspace(charstring)
  2566.     char *        charstring
  2567.     CODE:
  2568.     char *s;
  2569.     RETVAL = 1;
  2570.     for (s = charstring; *s && RETVAL; s++)
  2571.         if (!isspace(*s))
  2572.         RETVAL = 0;
  2573.     OUTPUT:
  2574.     RETVAL
  2575.  
  2576. int
  2577. isupper(charstring)
  2578.     char *        charstring
  2579.     CODE:
  2580.     char *s;
  2581.     RETVAL = 1;
  2582.     for (s = charstring; *s && RETVAL; s++)
  2583.         if (!isupper(*s))
  2584.         RETVAL = 0;
  2585.     OUTPUT:
  2586.     RETVAL
  2587.  
  2588. int
  2589. isxdigit(charstring)
  2590.     char *        charstring
  2591.     CODE:
  2592.     char *s;
  2593.     RETVAL = 1;
  2594.     for (s = charstring; *s && RETVAL; s++)
  2595.         if (!isxdigit(*s))
  2596.         RETVAL = 0;
  2597.     OUTPUT:
  2598.     RETVAL
  2599.  
  2600. SysRet
  2601. open(filename, flags = O_RDONLY, mode = 0666)
  2602.     char *        filename
  2603.     int        flags
  2604.     Mode_t        mode
  2605.  
  2606. HV *
  2607. localeconv()
  2608.     CODE:
  2609. #ifdef HAS_LOCALECONV
  2610.     struct lconv *lcbuf;
  2611.     RETVAL = newHV();
  2612.     if (lcbuf = localeconv()) {
  2613.         /* the strings */
  2614.         if (lcbuf->decimal_point && *lcbuf->decimal_point)
  2615.         hv_store(RETVAL, "decimal_point", 13,
  2616.             newSVpv(lcbuf->decimal_point, 0), 0);
  2617.         if (lcbuf->thousands_sep && *lcbuf->thousands_sep)
  2618.         hv_store(RETVAL, "thousands_sep", 13,
  2619.             newSVpv(lcbuf->thousands_sep, 0), 0);
  2620.         if (lcbuf->grouping && *lcbuf->grouping)
  2621.         hv_store(RETVAL, "grouping", 8,
  2622.             newSVpv(lcbuf->grouping, 0), 0);
  2623.         if (lcbuf->int_curr_symbol && *lcbuf->int_curr_symbol)
  2624.         hv_store(RETVAL, "int_curr_symbol", 15,
  2625.             newSVpv(lcbuf->int_curr_symbol, 0), 0);
  2626.         if (lcbuf->currency_symbol && *lcbuf->currency_symbol)
  2627.         hv_store(RETVAL, "currency_symbol", 15,
  2628.             newSVpv(lcbuf->currency_symbol, 0), 0);
  2629.         if (lcbuf->mon_decimal_point && *lcbuf->mon_decimal_point)
  2630.         hv_store(RETVAL, "mon_decimal_point", 17,
  2631.             newSVpv(lcbuf->mon_decimal_point, 0), 0);
  2632.         if (lcbuf->mon_thousands_sep && *lcbuf->mon_thousands_sep)
  2633.         hv_store(RETVAL, "mon_thousands_sep", 17,
  2634.             newSVpv(lcbuf->mon_thousands_sep, 0), 0);
  2635.         if (lcbuf->mon_grouping && *lcbuf->mon_grouping)
  2636.         hv_store(RETVAL, "mon_grouping", 12,
  2637.             newSVpv(lcbuf->mon_grouping, 0), 0);
  2638.         if (lcbuf->positive_sign && *lcbuf->positive_sign)
  2639.         hv_store(RETVAL, "positive_sign", 13,
  2640.             newSVpv(lcbuf->positive_sign, 0), 0);
  2641.         if (lcbuf->negative_sign && *lcbuf->negative_sign)
  2642.         hv_store(RETVAL, "negative_sign", 13,
  2643.             newSVpv(lcbuf->negative_sign, 0), 0);
  2644.         /* the integers */
  2645.         if (lcbuf->int_frac_digits != CHAR_MAX)
  2646.         hv_store(RETVAL, "int_frac_digits", 15,
  2647.             newSViv(lcbuf->int_frac_digits), 0);
  2648.         if (lcbuf->frac_digits != CHAR_MAX)
  2649.         hv_store(RETVAL, "frac_digits", 11,
  2650.             newSViv(lcbuf->frac_digits), 0);
  2651.         if (lcbuf->p_cs_precedes != CHAR_MAX)
  2652.         hv_store(RETVAL, "p_cs_precedes", 13,
  2653.             newSViv(lcbuf->p_cs_precedes), 0);
  2654.         if (lcbuf->p_sep_by_space != CHAR_MAX)
  2655.         hv_store(RETVAL, "p_sep_by_space", 14,
  2656.             newSViv(lcbuf->p_sep_by_space), 0);
  2657.         if (lcbuf->n_cs_precedes != CHAR_MAX)
  2658.         hv_store(RETVAL, "n_cs_precedes", 13,
  2659.             newSViv(lcbuf->n_cs_precedes), 0);
  2660.         if (lcbuf->n_sep_by_space != CHAR_MAX)
  2661.         hv_store(RETVAL, "n_sep_by_space", 14,
  2662.             newSViv(lcbuf->n_sep_by_space), 0);
  2663.         if (lcbuf->p_sign_posn != CHAR_MAX)
  2664.         hv_store(RETVAL, "p_sign_posn", 11,
  2665.             newSViv(lcbuf->p_sign_posn), 0);
  2666.         if (lcbuf->n_sign_posn != CHAR_MAX)
  2667.         hv_store(RETVAL, "n_sign_posn", 11,
  2668.             newSViv(lcbuf->n_sign_posn), 0);
  2669.     }
  2670. #else
  2671.     localeconv(); /* A stub to call not_here(). */
  2672. #endif
  2673.     OUTPUT:
  2674.     RETVAL
  2675.  
  2676. char *
  2677. setlocale(category, locale)
  2678.     int        category
  2679.     char *        locale
  2680.  
  2681. double
  2682. acos(x)
  2683.     double        x
  2684.  
  2685. double
  2686. asin(x)
  2687.     double        x
  2688.  
  2689. double
  2690. atan(x)
  2691.     double        x
  2692.  
  2693. double
  2694. ceil(x)
  2695.     double        x
  2696.  
  2697. double
  2698. cosh(x)
  2699.     double        x
  2700.  
  2701. double
  2702. floor(x)
  2703.     double        x
  2704.  
  2705. double
  2706. fmod(x,y)
  2707.     double        x
  2708.     double        y
  2709.  
  2710. void
  2711. frexp(x)
  2712.     double        x
  2713.     PPCODE:
  2714.     int expvar;
  2715.     /* (We already know stack is long enough.) */
  2716.     PUSHs(sv_2mortal(newSVnv(frexp(x,&expvar))));
  2717.     PUSHs(sv_2mortal(newSViv(expvar)));
  2718.  
  2719. double
  2720. ldexp(x,exp)
  2721.     double        x
  2722.     int        exp
  2723.  
  2724. double
  2725. log10(x)
  2726.     double        x
  2727.  
  2728. void
  2729. modf(x)
  2730.     double        x
  2731.     PPCODE:
  2732.     double intvar;
  2733.     /* (We already know stack is long enough.) */
  2734.     PUSHs(sv_2mortal(newSVnv(modf(x,&intvar))));
  2735.     PUSHs(sv_2mortal(newSVnv(intvar)));
  2736.  
  2737. double
  2738. sinh(x)
  2739.     double        x
  2740.  
  2741. double
  2742. tanh(x)
  2743.     double        x
  2744.  
  2745.  
  2746. SysRet
  2747. close(fd)
  2748.     int        fd
  2749.  
  2750. SysRet
  2751. dup(fd)
  2752.     int        fd
  2753.  
  2754. SysRet
  2755. dup2(fd1, fd2)
  2756.     int        fd1
  2757.     int        fd2
  2758.  
  2759. SysRet
  2760. lseek(fd, offset, whence)
  2761.     int        fd
  2762.     Off_t        offset
  2763.     int        whence
  2764.  
  2765. SysRet
  2766. nice(incr)
  2767.     int        incr
  2768.  
  2769. int
  2770. pipe()
  2771.     PPCODE:
  2772.     int fds[2];
  2773.     if (pipe(fds) != -1) {
  2774.         EXTEND(sp,2);
  2775.         PUSHs(sv_2mortal(newSViv(fds[0])));
  2776.         PUSHs(sv_2mortal(newSViv(fds[1])));
  2777.     }
  2778.  
  2779. SysRet
  2780. read(fd, buffer, nbytes)
  2781.     int        fd
  2782.     char *        buffer = sv_grow(ST(1),SvIV(ST(2))+1);
  2783.     size_t        nbytes
  2784.     CLEANUP:
  2785.     if (RETVAL >= 0) {
  2786.         SvCUR(ST(1)) = RETVAL;
  2787.         SvPOK_only(ST(1));
  2788.         *SvEND(ST(1)) = '\0';
  2789.         if (tainting)
  2790.         sv_magic(ST(1), 0, 't', 0, 0);
  2791.     }
  2792.  
  2793. SysRet
  2794. setgid(gid)
  2795.     Gid_t        gid
  2796.  
  2797. SysRet
  2798. setpgid(pid, pgid)
  2799.     pid_t        pid
  2800.     pid_t        pgid
  2801.  
  2802. pid_t
  2803. setsid()
  2804.  
  2805. SysRet
  2806. setuid(uid)
  2807.     Uid_t        uid
  2808.  
  2809. pid_t
  2810. tcgetpgrp(fd)
  2811.     int        fd
  2812.  
  2813. SysRet
  2814. tcsetpgrp(fd, pgrp_id)
  2815.     int        fd
  2816.     pid_t        pgrp_id
  2817.  
  2818. int
  2819. uname()
  2820.     PPCODE:
  2821. #ifdef HAS_UNAME
  2822.     struct utsname buf;
  2823.     if (uname(&buf) >= 0) {
  2824.         EXTEND(sp, 5);
  2825.         PUSHs(sv_2mortal(newSVpv(buf.sysname, 0)));
  2826.         PUSHs(sv_2mortal(newSVpv(buf.nodename, 0)));
  2827.         PUSHs(sv_2mortal(newSVpv(buf.release, 0)));
  2828.         PUSHs(sv_2mortal(newSVpv(buf.version, 0)));
  2829.         PUSHs(sv_2mortal(newSVpv(buf.machine, 0)));
  2830.     }
  2831. #else
  2832.     uname((char *) 0); /* A stub to call not_here(). */
  2833. #endif
  2834.  
  2835. SysRet
  2836. write(fd, buffer, nbytes)
  2837.     int        fd
  2838.     char *        buffer
  2839.     size_t        nbytes
  2840.  
  2841. char *
  2842. tmpnam(s = 0)
  2843.     char *        s = 0;
  2844.  
  2845. void
  2846. abort()
  2847.  
  2848. int
  2849. mblen(s, n)
  2850.     char *        s
  2851.     size_t        n
  2852.  
  2853. size_t
  2854. mbstowcs(s, pwcs, n)
  2855.     wchar_t *    s
  2856.     char *        pwcs
  2857.     size_t        n
  2858.  
  2859. int
  2860. mbtowc(pwc, s, n)
  2861.     wchar_t *    pwc
  2862.     char *        s
  2863.     size_t        n
  2864.  
  2865. int
  2866. wcstombs(s, pwcs, n)
  2867.     char *        s
  2868.     wchar_t *    pwcs
  2869.     size_t        n
  2870.  
  2871. int
  2872. wctomb(s, wchar)
  2873.     char *        s
  2874.     wchar_t        wchar
  2875.  
  2876. int
  2877. strcoll(s1, s2)
  2878.     char *        s1
  2879.     char *        s2
  2880.  
  2881. SV *
  2882. strxfrm(src)
  2883.     SV *        src
  2884.     CODE:
  2885.     {
  2886.           STRLEN srclen;
  2887.           STRLEN dstlen;
  2888.           char *p = SvPV(src,srclen);
  2889.           srclen++;
  2890.           ST(0) = sv_2mortal(newSV(srclen));
  2891.           dstlen = strxfrm(SvPVX(ST(0)), p, (size_t)srclen);
  2892.           if (dstlen > srclen) {
  2893.               dstlen++;
  2894.               SvGROW(ST(0), dstlen);
  2895.               strxfrm(SvPVX(ST(0)), p, (size_t)dstlen);
  2896.               dstlen--;
  2897.           }
  2898.           SvCUR(ST(0)) = dstlen;
  2899.         SvPOK_only(ST(0));
  2900.     }
  2901.  
  2902. SysRet
  2903. mkfifo(filename, mode)
  2904.     char *        filename
  2905.     Mode_t        mode
  2906.  
  2907. SysRet
  2908. tcdrain(fd)
  2909.     int        fd
  2910.  
  2911.  
  2912. SysRet
  2913. tcflow(fd, action)
  2914.     int        fd
  2915.     int        action
  2916.  
  2917.  
  2918. SysRet
  2919. tcflush(fd, queue_selector)
  2920.     int        fd
  2921.     int        queue_selector
  2922.  
  2923. SysRet
  2924. tcsendbreak(fd, duration)
  2925.     int        fd
  2926.     int        duration
  2927.  
  2928. char *
  2929. asctime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
  2930.     int        sec
  2931.     int        min
  2932.     int        hour
  2933.     int        mday
  2934.     int        mon
  2935.     int        year
  2936.     int        wday
  2937.     int        yday
  2938.     int        isdst
  2939.     CODE:
  2940.     {
  2941.         struct tm mytm;
  2942.         mytm.tm_sec = sec;
  2943.         mytm.tm_min = min;
  2944.         mytm.tm_hour = hour;
  2945.         mytm.tm_mday = mday;
  2946.         mytm.tm_mon = mon;
  2947.         mytm.tm_year = year;
  2948.         mytm.tm_wday = wday;
  2949.         mytm.tm_yday = yday;
  2950.         mytm.tm_isdst = isdst;
  2951.         RETVAL = asctime(&mytm);
  2952.     }
  2953.     OUTPUT:
  2954.     RETVAL
  2955.  
  2956. long
  2957. clock()
  2958.  
  2959. char *
  2960. ctime(time)
  2961.     Time_t *    time
  2962.  
  2963. double
  2964. difftime(time1, time2)
  2965.     Time_t        time1
  2966.     Time_t        time2
  2967.  
  2968. SysRetLong
  2969. mktime(sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
  2970.     int        sec
  2971.     int        min
  2972.     int        hour
  2973.     int        mday
  2974.     int        mon
  2975.     int        year
  2976.     int        wday
  2977.     int        yday
  2978.     int        isdst
  2979.     CODE:
  2980.     {
  2981.         struct tm mytm;
  2982.         mytm.tm_sec = sec;
  2983.         mytm.tm_min = min;
  2984.         mytm.tm_hour = hour;
  2985.         mytm.tm_mday = mday;
  2986.         mytm.tm_mon = mon;
  2987.         mytm.tm_year = year;
  2988.         mytm.tm_wday = wday;
  2989.         mytm.tm_yday = yday;
  2990.         mytm.tm_isdst = isdst;
  2991.         RETVAL = mktime(&mytm);
  2992.     }
  2993.     OUTPUT:
  2994.     RETVAL
  2995.  
  2996. char *
  2997. strftime(fmt, sec, min, hour, mday, mon, year, wday = 0, yday = 0, isdst = 0)
  2998.     char *        fmt
  2999.     int        sec
  3000.     int        min
  3001.     int        hour
  3002.     int        mday
  3003.     int        mon
  3004.     int        year
  3005.     int        wday
  3006.     int        yday
  3007.     int        isdst
  3008.     CODE:
  3009.     {
  3010.         char tmpbuf[128];
  3011.         struct tm mytm;
  3012.         int len;
  3013.         mytm.tm_sec = sec;
  3014.         mytm.tm_min = min;
  3015.         mytm.tm_hour = hour;
  3016.         mytm.tm_mday = mday;
  3017.         mytm.tm_mon = mon;
  3018.         mytm.tm_year = year;
  3019.         mytm.tm_wday = wday;
  3020.         mytm.tm_yday = yday;
  3021.         mytm.tm_isdst = isdst;
  3022.         len = strftime(tmpbuf, sizeof tmpbuf, fmt, &mytm);
  3023.         ST(0) = sv_2mortal(newSVpv(tmpbuf, len));
  3024.     }
  3025.  
  3026. void
  3027. tzset()
  3028.  
  3029. void
  3030. tzname()
  3031.     PPCODE:
  3032.     EXTEND(sp,2);
  3033.     PUSHs(sv_2mortal(newSVpv(tzname[0],strlen(tzname[0]))));
  3034.     PUSHs(sv_2mortal(newSVpv(tzname[1],strlen(tzname[1]))));
  3035.  
  3036. SysRet
  3037. access(filename, mode)
  3038.     char *        filename
  3039.     Mode_t        mode
  3040.  
  3041. char *
  3042. ctermid(s = 0)
  3043.     char *        s = 0;
  3044.  
  3045. char *
  3046. cuserid(s = 0)
  3047.     char *        s = 0;
  3048.  
  3049. SysRetLong
  3050. fpathconf(fd, name)
  3051.     int        fd
  3052.     int        name
  3053.  
  3054. SysRetLong
  3055. pathconf(filename, name)
  3056.     char *        filename
  3057.     int        name
  3058.  
  3059. SysRet
  3060. pause()
  3061.  
  3062. SysRetLong
  3063. sysconf(name)
  3064.     int        name
  3065.  
  3066. char *
  3067. ttyname(fd)
  3068.     int        fd
  3069.